Observed since 21 Oct, 10:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Aidbox client for python
Aidbox client for python. This package provides an API for CRUD operations over Aidbox resources.
The library is based on fhir-py and the main difference between libraries in our case is the way they represent resource references (read more about differences).
Aidbox-py also going to support some Aidbox features like _assoc operation, AidboxQuery and so on.
Most examples from fhir-py readme also work for aidbox-py (but you need to replace FHIR client with AsyncAidboxClient/SyncAidboxClient). See base aidbox-py example below.
Most recent version:
pip install git+https://github.com/beda-software/aidbox-py.git
PyPi:
pip install aidboxpy
import asyncio
from aidboxpy import AsyncAidboxClient
from fhirpy.base.exceptions import (
OperationOutcome, ResourceNotFound, MultipleResourcesFound
)
async def main():
# Create an instance
client = AsyncAidboxClient(
'http://localhost:8080',
authorization='Bearer TOKEN'
)
# Search for patients
resources = client.resources('Patient') # Return lazy search set
resources = resources.search(name='John').limit(10).page(2).sort('name')
patients = await resources.fetch() # Returns a list of AsyncAidboxResource
# Get exactly one resource
try:
patient = await client.resources('Practitioner') \
.search(id='id').get()
except ResourceNotFound:
pass
except MultipleResourcesFound:
pass
# Validate resource
try:
await client.resource(
'Person',
custom_prop='123',
telecom=True
).is_valid()
except OperationOutcome as e:
print('Error: {}'.format(e))
# Create Organization resource
organization = client.resource(
'Organization',
name='beda.software',
active=False
)
await organization.save()
# Get patient resource by reference and delete
patient_ref = client.reference('Patient', 'new_patient')
patient_res = await patient_ref.to_resource()
await patient_res.delete()
# Iterate over search set and change organization
org_resources = client.resources('Organization').search(active=False)
async for org_resource in org_resources:
org_resource['active'] = True
await org_resource.save()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Import library:
from aidboxpy import SyncAidboxClient
or
from aidboxpy import AsyncAidboxClient
To create AidboxClient instance use:
SyncAidboxClient(url, authorization='', extra_headers={})
or
AsyncAidboxClient(url, authorization='', extra_headers={})
Returns an instance of the connection to the server which provides:
SyncAidboxReference/AsyncAidboxReference to the resourceSyncAidboxResource/AsyncAidboxResource which described belowSyncAidboxSearchSet/AsyncAidboxSearchSetSyncAidboxResource/AsyncAidboxResource
provides:
SyncAidboxReference/AsyncAidboxReference for this resourceSyncAidboxReference/AsyncAidboxReference
provides:
SyncAidboxResource/AsyncAidboxResource for this referenceSyncAidboxSearchSet/AsyncAidboxSearchSet
provides:
async .fetch() - makes query to the server and returns a list of Resource filtered by resource typeasync .fetch_all() - makes query to the server and returns a full list of Resource filtered by resource typeasync .fetch_raw() - makes query to the server and returns a raw Bundle Resourceasync .first() - returns Resource or Noneasync .get(id=None) - returns Resource or raises ResourceNotFound when no resource found or MultipleResourcesFound when more than one resource found (parameter 'id' is deprecated)async .count() - makes query to the server and returns the total number of resources that match the SearchSetDownload counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.3.0 | 16 Nov 2021 | 1 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:25b7ad47c43f62932830978ad13e34b00e52b399c565e3f3fa6224dea75f78a2