Skip to main content

Top-level package for xedocs.

Project description

xedocs is meant to replace cmt and bodega as well as helping tracking all shared documents especially if they need to be versioned.

What does Xedocs give you

Data reading

  • Read data from multiple formats (e.g. mongodb, pandas) and locations with a simple unified interface.

  • Custom logic implemented on the document class, e.g. creating a tensorflow model from the data etc.

  • Multiple APIs for reading data, fun functional, ODM style, pandas and xarray.

  • Read data as objects, dataframes, dicts, json.

Writing data

  • Write data to multiple storage backends with the same interface

  • Custom per-collection rules for data insertion, deletion and updating.

  • Schema validation and type coercion so storage has uniform and consistent data.

Other

  • Custom panel widgets for graphical representation of data, web client

  • Auto-generated API server and client + openapi documentation

  • CLI for viewing and downloading data

Basic Usage

Explore the available schemas

import xedocs

>>> xedocs.list_schemas()
>>> ['detector_numbers',
    'fax_configs',
    'plugin_lineages',
    'context_lineages',
    'pmt_gains',
    'global_versions',
    'electron_drift_velocities',
    ...]

>>> xedocs.help('pmt_gains')

>>>
        Schema name: pmt_gains
        Index fields: ['version', 'time', 'detector', 'pmt']
        Column fields: ['created_date', 'comments', 'value']

Read/write data from the shared development database, this database is writable from the default analysis username/password

import xedocs

db = xedocs.development_db()

docs = db.pmt_gains.find_docs(version='v1', pmt=[1,2,3,5], time='2021-01-01T00:00:00', detector='tpc')
gains = [doc.value for doc in docs]

doc = db.pmt_gains.find_one(version='v1', pmt=1, time='2021-01-01T00:00:00', detector='tpc')
pmt1_gain = doc.value

Read from the straxen processing database, this database is read-only for the default analysis username/password

import xedocs

db = xedocs.straxen_db()

...

Read from the the corrections gitub repository, this database is read-only

import xedocs

db = xedocs.corrections_repo(branch="master")

...

Read data from alternative data sources specified by path, e.g csv files which will be loaded by pandas.

from xedocs.schemas import DetectorNumber

g1_doc = DetectorNumber.find_one(datasource='/path/to/file.csv', version='v1', field='g1')
g1_value = g1_doc.value
g1_error = g1_doc.uncertainty

The path can also be a github URL or any other URL supported by fsspec.

from xedocs.schemas import DetectorNumber

g1_doc = DetectorNumber.find_one(
                         datasource='github://org:repo@/path/to/file.csv',
                         version='v1',
                         field='g1')

Supported data sources

  • MongoDB collections

  • TinyDB tables

  • JSON files

  • REST API clients

Please open an issue on rframe if you want support for an additional data format.

If you want a new datasource to be available from a schema class, you can register it to the class:

from xedocs.schemas import DetectorNumber

DetectorNumber.register_datasource('github://org:repo@/path/to/file.csv', name='github_repo')

# The source will now be available under the given name:

g1_doc = DetectorNumber.github_repo.find_one(version='v1', field='g1')

Documentation

Full documentation hosted by Readthedocs

Credits

This package was created with Cookiecutter and the briggySmalls/cookiecutter-pypackage project template.

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

xedocs-0.2.19.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

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

xedocs-0.2.19-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file xedocs-0.2.19.tar.gz.

File metadata

  • Download URL: xedocs-0.2.19.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.11.0 Linux/5.15.0-1037-azure

File hashes

Hashes for xedocs-0.2.19.tar.gz
Algorithm Hash digest
SHA256 c354b1404581c6e9904f21bf7d01a3b46b90403ac9fc7060b8e8e7c701ff636c
MD5 1ac1c1fca0027547b0618faac356274d
BLAKE2b-256 170757688e452a67b5a263abe5d506596d4f6ad18da91d9c920f08867e6d5329

See more details on using hashes here.

File details

Details for the file xedocs-0.2.19-py3-none-any.whl.

File metadata

  • Download URL: xedocs-0.2.19-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.11.0 Linux/5.15.0-1037-azure

File hashes

Hashes for xedocs-0.2.19-py3-none-any.whl
Algorithm Hash digest
SHA256 ef0682cb34645e7b3391459a92a8b1a79dedf484f6d08d792cb16094a0ab1398
MD5 272e30166c697e209903720460743e44
BLAKE2b-256 678b42d53a272a8000455286e10f792b7d4133f11bdc62cdd5e381a02896bd36

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