Acknowledgement: Based on a fork of the amazing open source library by Aidbox
- Integrate with db per user architecture
- Add Language Model integration
pip install git+https://github.com/Technoculture/fhir-types-python
TODO
from elladb.resource.appointment import Appointment, Appointment_Participant
from elladb.resource.patient import Patient
from elladb.resource.practitioner import Practitioner
from elladb.base import Reference, HumanName
import requests
patient = Patient(name=[HumanName(family="Bourne", given=["Jason"])])
practitioner = Practitioner(name=[HumanName(family="Smith", given=["John"])])
patient.save()
practitioner.save()
try:
Appointment(
status="booked",
participant=[
Appointment_Participant(
status="accepted",
actor=Reference(reference="Practitioner/" + (practitioner.id or "")),
),
Appointment_Participant(
status="accepted",
actor=Reference(reference="Patient/" + (patient.id or "")),
),
],
).save()
except requests.exceptions.RequestException as e:
if e.response is not None:
print(e.response.json())
from elladb.resource.patient import Patient
from elladb.base import HumanName
patient = Patient()
patient.name = [HumanName(family="Bourne", given=["Jason"])]
patient.save()
from elladb.resource.patient import Patient
patient = Patient(id="patient-1")
patient.delete()
from elladb.resource.patient import Patient
patient = Patient.from_id("patient-1")
from elladb.resource.patient import Patient
from elladb.base import Page, Count, Sort, Where
patients = Patient.get(Where('active', True), Count(10), Page(3), Sort('created_at', 'desc'))
from elladb.base import API
API.request(endpoint="/EllaTask", method="GET")
API.request(
endpoint="/rpc",
method="POST",
json={
"method": "awf.task/list",
"params": { "filter": { "excludeDefinitions": ["awf.workflow/decision-task"] }},
},
)
from elladb.resource.patient import Patient
from elladb.base import Page, Count, Sort, Where
patient = Patient.from_id('patient-1')
patient_json = patient.dumps(exclude_unset=True)
from elladb.base import API
entry = []
entry.append(
{
"resource": patient.dumps(exclude_unset=True),
"request": {"method": "POST", "url": "Patient"},
},
{
"resource": patient.dumps(exclude_unset=True),
"request": {"method": "POST", "url": "Patient"},
},
)
try:
API.bundle(entry=entry, type="transaction")
except requests.exceptions.RequestException as e:
if e.response is not None:
print(e.response.json())