Namespaces

FHIR

ovok.fhir is a generic FHIR R4 client for any resource type. Resources are plain

  • Stable unknown
  • Release candidate since 0.1.0-rc.3
  • Development since 0.1.0-dev.21+c43ebba

ovok.fhir is a generic FHIR R4 client for any resource type. Resources are plain dictionaries in FHIR JSON shape. Use it when no dedicated namespace covers the resource.

search returns a Page. A list value repeats its parameter, which FHIR reads as AND.

from ovok_sdk import Ovok

ovok = Ovok("https://api.sandbox.ovok.com", "your-tenant")

patient = ovok.fhir.read("Patient", "patient-id")
page = ovok.fhir.search("Observation", {"patient": "Patient/patient-id", "_count": 50})
for observation in page.auto_paging_iter():
    print(observation["id"])

first = ovok.fhir.search_one("Patient", {"identifier": "https://example.com/mrn|123"})

Create without duplicates

With if_none_exist, the server returns the existing match instead of creating a second resource, so the request is safe to retry.

ovok.fhir.create(
    {
        "resourceType": "Patient",
        "identifier": [{"system": "https://example.com/mrn", "value": "123"}],
    },
    if_none_exist="identifier=https://example.com/mrn|123",
)

Update, patch and delete

patient["active"] = False
ovok.fhir.update(patient)
ovok.fhir.patch("Patient", "patient-id", [{"op": "replace", "path": "/active", "value": True}])
ovok.fhir.delete("Patient", "patient-id")

Send a transaction

ovok.fhir.batch({
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {"request": {"method": "POST", "url": "Observation"}, "resource": observation},
    ],
})

API reference

See ovok_sdk.resources.fhir for every method, parameter and error.

Last updated on

On this page