Skip to main content

ivcap-df

A Python Library for interacting with the IVCAP Data Fabric

Defining Schemas

I need to define a much simpler example. Maybe along the lines of the classical Elementary School experiment of growing grass seeds with different amount of water added every so often - with maybe an imge taken as well for every observation

from ivcap_df import Schema, IdColumn, RefColumn, Column, ColType, Connector

common_ns = 'common'
geo_location_s = Schema('geo_location', common_ns, 'The geographic coordinates of a place or event', [
    Column('elevation', ColType.FLOAT64, description="The elevation of a location (WGS 84). Value alone should be assumed to be in meters.", required=False),
    Column('latitude', ColType.FLOAT64, description="The latitude of a location. For example 37.42242 (WGS 84)."),
    Column('longitude', ColType.FLOAT64, description="The longitude of a location. For example -122.08585 (WGS 84)."),
])

geo_line_s = Schema('geo_line', common_ns, 'The geographic coordinates of a line defined by a from and to locations', [
    RefColumn('from', geo_location_s, description='Location of the beginning of the line'), 
    RefColumn('to', geo_location_s, description='Location of the end of the line'), 
])

image_s = Schema('image', common_ns, 'An image',  [
    Column('url', ColType.STRING, format='uri'),
    Column('description', ColType.STRING, required=False),
    Column('format', ColType.STRING, required=False),
    Column('width', ColType.INT64, description="Image width in pixels", unit='pixel', required=False),
    Column('height', ColType.INT64, description="Image height in pixels", unit='pixel', required=False),
    Column('dateTime', ColType.STRING, description='The date and time this image was taken (in ISO 8601 date format).', format='date-time', required=False),
    RefColumn('location', geo_location_s, required=False), 
])

To visualise the schema relationships, execute the following in a Jupyter Notebook:

schemas = {
    'geo_location_s': geo_location_s,
    'geo_line_s': geo_line_s,
    'image': image_s,
}

Schema.to_dot(schemas.values(), fontSize=10)

To persist the schema definition to IVCAP, run the following:

from ivcap_prov import Connector

ivcap_params = {"type": "ivcap",  ...}
db = Connector.create(**ivcap_params)
for name, schema in schemas.items():
    print(name)
    schema.persist(db, verbose=False)
print("...schema done")

db.close()

Loading Data

First we will need to load the respective schemas:

from ivcap_prov import Connector,Schema

bg_ns = 'blue_growth'
ivcap_ns = 'ivcap'

db = Connector.create(**ivcap_params)
qimage_s = Schema.load(db, 'quadrat_image', bg_ns)
image_artifact_s = Schema.load(db, 'image_artifact', ivcap_ns)

Metadata

Release files for ivcap-df 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ivcap-df 0.4.0
File Size Uploaded
ivcap_df-0.4.0.tar.gz 27.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ivcap-df 0.4.0
File Interpreter ABI Platform
ivcap_df-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.3 kB

Release files / ivcap_df-0.4.0.tar.gz

Download URL ivcap_df-0.4.0.tar.gz
Size 27.5 kB
Tags Source
SHA-256 checksum
How to use checksums
190414d2f8aeb4fe11402fb83037d6dd7f40a768998a838692384783ed927f34
BLAKE2b-256 checksum
How to use checksums
13e1758ae5b74d8a75e173b3d9973f35f62c19bd37c24f37f169639967e3641c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.9.16 Darwin/22.5.0

Release files / ivcap_df-0.4.0-py3-none-any.whl

Download URL ivcap_df-0.4.0-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f584211ef8161e298791bc64f99048182d81ec15b6e684ba944375bd64292f14
BLAKE2b-256 checksum
How to use checksums
fd4230da68914966fa71de6757c2aae00a1f90de5de62ba33fbd35da1bbf4057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.9.16 Darwin/22.5.0

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page