Skip to main content

Aidbox client for python

Project description

Build Status codecov pypi

aidbox-py

Aidbox client for python. This package provides an API for CRUD operations over aidbox resources

API

To obtain token by email and password use static method: Aidbox.obtain_token(url, email, password)

To create Aidbox instance use:

Aidbox(url, authorization)

Returns an instance of the connection to the aidbox server which provides:

  • .reference(resource_type, id, **kwargs) - returns AidboxReference to the resource
  • .resource(resource_type, **kwargs) - returns AidboxResource which described below
  • .resources(resource_type) - returns AidboxSearchSet

AidboxResource

provides:

  • .save() - creates or updates resource instance
  • .delete() - deletes resource instance
  • .to_reference(**kwargs) - returns AidboxReference for this resource
  • setattr/getattr using dot operator

AidboxReference

provides:

  • .to_resource() - returns AidboxResource for this reference

AidboxSearchSet

provides:

  • .search(param=value)
  • .limit(count)
  • .page(page)
  • .sort(*args)
  • .execute() - makes query to the server and returns a list of AidboxResource
  • .first() - returns AidboxResource or None
  • .get(id=id) - returns AidboxResource or raises AidboxResourceNotFound

Usage

Create an instance

ab = Aidbox(url='http://path-to-fhir-server', authorization='Bearer TOKEN')

Fetch list of resource's instances

resources = ab.resources('Patient')  # Return lazy search set
resources = resources.search(name='John').limit(10).page(2).sort('name')

resources.execute()  # Returns list of AidboxResource

Get the particular instance of resource

res = ab.resources('Entity').get(id='ID')

Create new resource's instance

res = ab.resource('Entity')
res.name = 'Chat'
res.save()  # Creates new instance

res.name = 'Chat2'
res.save()  # Updates the instance

res.delete()  # Deletes the instance

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
aidbox-0.2.0.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page