Skip to main content

Bridge shared datasets across diverse projects.

Project description

databridge

The databridge package streamlines the management of common datasets across diverse projects. It facilitates the setup of paths, file names, and Python commands to access centralized files efficiently.

Why Use databridge?

Managing common datasets across multiple projects often involves repetitive tasks such as saving files, configuring paths, and importing libraries. The databridge package aims to simplify this process by offering a centralized data bucket.

Instead of manually saving files and configuring paths for each project, databridge allows you to create a config.json file. This file guides Python on where to locate common datasets locally, reducing redundancy and enhancing efficiency.

Example 1 - Without databridge

# Import geopandas package
import geopandas as gpd

# Import data
texas_boundaries = gpd.read_file("myproject_data_folder/Texas_boundaries.shp")

This method is straightforward but can become repetitive when dealing with multiple projects.

Example 2 - with databrigde

# Import databridge package
from databridge.databridge import data_bridge as db

# List all available datasets
db.list_datasets()

# Load dataset
texas_boundaries = db.load_dataset("local", "texas_boundaries")

Although Example 2 has the same number of line of code as Example 1, it significantly reduces redundancy. When dealing with multiple projects, you no longer need to save the file multiple times or manually set different paths.

Explore the power of databridge to enhance your workflow and centralize your datasets effortlessly.

How to configure databridge?

To configure databridge, you need to create a config.json file in the same location where the databridge package is installed. The config.json file should contain the following structure:

{
  "local": {
    "dataset_name": {
        "path": "absolute path to dataset file",
        "file": "file name including extension",
        "function": "function to load the dataset (e.g., gpd.read_file)"
    },
    "texas_boundaries": {
        "path": "C:/Users/username/Documents/myproject_data_folder",
        "file": "Texas_boundaries.shp",
        "function": "gpd.read_file"
  }
}

The package has a built-in method to create the config.json file.

# Import databridge package
from databridge.databridge import config_updater as cfu

# Update config.json file
cfu.update_config(
    environment="local",
    dataset_name="texas_boundaries",
    path="C:/Users/username/Documents/myproject_data_folder",
    file="Texas_boundaries.shp",
    function="gpd.read_file"
    )

# Save the updated config.json file
cfu.save_config()

The config.json file is now updated with the new dataset information.

How to use databridge?

To use databridge, you need to install the package and import the DataBridge class.

# Import databridge package
from databridge.databridge import data_btidge as db

# List all available datasets
db.list_datasets()

# Load dataset
df = db.load_dataset("local", "texas_boundaries")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

databridge-0.2.6.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

databridge-0.2.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file databridge-0.2.6.tar.gz.

File metadata

  • Download URL: databridge-0.2.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for databridge-0.2.6.tar.gz
Algorithm Hash digest
SHA256 acd8108ef09aab05fa1e5321ef6a9f0b9025131263d33304d1aa1ac2a12f5f45
MD5 e905453ed844d19519326fbdef3da131
BLAKE2b-256 0989a4c66b280d8d4866b2c7a86cebe2a7e9a085c430269170047e0975494215

See more details on using hashes here.

File details

Details for the file databridge-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: databridge-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for databridge-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c16e62d461d976a641e3f409d88ea1d9b032923622d67ee36b1d9404fa2618a0
MD5 7fe9dccfccf2c7301c46e2f711922985
BLAKE2b-256 b30f26c1442672dfc0cc8b4bcb38ec350d2e86c10bbc6f5e84163c0cb1d16f42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page