Skip to main content
POST
/
v1
/
fhir
/
resource
import olira

olira.init(api_key="YOUR_API_KEY")
result = olira.log_fhir(
    patient_id="8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
    resource={
        "resourceType": "Observation",
        "id": "bp-example",
        "status": "final",
        "category": [{
            "coding": [{
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "code": "vital-signs",
            }],
        }],
        "code": {
            "coding": [{
                "system": "http://loinc.org",
                "code": "85354-9",
                "display": "Blood pressure panel",
            }],
        },
        "subject": {"reference": "Patient/example"},
        "effectiveDateTime": "2026-05-01T10:00:00Z",
        "component": [
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8480-6"}]},
                "valueQuantity": {"value": 120, "unit": "mmHg"},
            },
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8462-4"}]},
                "valueQuantity": {"value": 80, "unit": "mmHg"},
            },
        ],
    },
)
print(result.accepted, result.failed)
BatchResult(accepted=1, failed=0, errors=[])
olira.log_fhir(patient_id: str, resource: dict[str, Any]) -> BatchResult
Requires scope: sdk:event-log Olira maps it to one or more platform log types via the FHIR absorber (same schema mapper used by Epic/Cerner integrations and Console FHIR upload), then processes each event immediately for the patient — unlike olira.log(), you do not choose log_type or build Olira-shaped payloads yourself. One resource may produce zero events (unsupported type or unmappable fields), one event, or several (e.g. CarePlan). See Supported FHIR resources below for the full resourceType → event type matrix.

Parameters

patient_id
str
required
Olira patient id (from create_patient or your patient registry).
resource
dict[str, Any]
required
FHIR R4 resource object with resourceType set. Supported types are listed in Supported FHIR resources below (17 resource families, including Observation, Condition, MedicationRequest, Patient, DocumentReference, DiagnosticReport, etc.).

Returns

BatchResult
accepted
int
Number of mapped events processed through patient state.
failed
int
Number of mapped events skipped or failed.
errors
list[BatchError]
Mapping or processing errors (e.g. unknown resource fields, replay conflict).

Supported FHIR resources

FHIR resourceTypeOlira event type(s)Notes
Observationvitals_measurement, lab_results, genomic_variant, clinical_measurement, functional_class, clinical_finding, social_determinants, treatment_response_assessmentRouted by category and LOINC. Vital-signs Observations at the same effectiveDateTime merge into one vitals_measurement when submitted in a multi-entry Bundle; via log_fhir (single resource) each vital-signs Observation is processed alone.
Patientdemographics
Appointmentcare_encounter
Encountercare_encounter
Conditioncondition
MedicationRequest, MedicationStatement, MedicationAdministrationmedication_list_updateMedication display/dose resolved from the resource; sibling Medication entries in a Bundle are not visible to log_fhir.
AllergyIntoleranceallergy_intolerance
CarePlanclinical_plan_item, treatment_phasetreatment_phase uses a heuristic on plan category/text.
CareTeamcare_team
DiagnosticReportlab_results, imaging_result, procedure_result, unstructured_reportNever clinical_note. Panel lab results need referenced Observation resources in the same Bundle; log_fhir cannot resolve result[] references across separate calls.
DocumentReferenceclinical_note, unstructured_reportInline base64 attachment.data is decoded into note text. attachment.url is not fetched — placeholder text only.
Procedureprocedure
Immunizationimmunization
FamilyMemberHistoryfamily_history
Goalcare_goal
Coverageinsurance
RelatedPersonemergency_contact

Per-resource examples

import olira

olira.init(api_key="YOUR_API_KEY")
result = olira.log_fhir(
    patient_id="8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
    resource={
        "resourceType": "Observation",
        "id": "bp-example",
        "status": "final",
        "category": [{
            "coding": [{
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "code": "vital-signs",
            }],
        }],
        "code": {
            "coding": [{
                "system": "http://loinc.org",
                "code": "85354-9",
                "display": "Blood pressure panel",
            }],
        },
        "subject": {"reference": "Patient/example"},
        "effectiveDateTime": "2026-05-01T10:00:00Z",
        "component": [
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8480-6"}]},
                "valueQuantity": {"value": 120, "unit": "mmHg"},
            },
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8462-4"}]},
                "valueQuantity": {"value": 80, "unit": "mmHg"},
            },
        ],
    },
)
print(result.accepted, result.failed)
Each call accepts one FHIR resource. Linked resources in the same payload are not resolved together (for example, lab Observations referenced from a DiagnosticReport). Use historical ingestion or an EHR integration when you need multi-resource imports.
Unsupported resource types (zero events accepted): QuestionnaireResponse, ImagingStudy, ServiceRequest, Task, AdverseEvent, Device, EpisodeOfCare, ClinicalImpression, MolecularSequence, and standalone Binary. Support for additional FHIR resource types is added continuously.
Ingested data is stored as Olira event logs (type and payload), not as raw FHIR. Read it back with get_logs() or logs().

Raises

ExceptionWhen
AuthErrorHTTP 401 or 403 — invalid API key or insufficient OAuth scope for this endpoint.
ServerErrorHTTP 409 (e.g. conflicting external identifier) or repeated 5xx after retries; includes status_code when applicable.
RateLimitErrorHTTP 429 — rate limited; check retry_after (seconds).
NetworkErrorConnection timeout, DNS failure, or read error after retries.
ValidationErrorHTTP 422 — missing resourceType or malformed request. Also raised when the resource maps to zero Olira events (unsupported type, unrecognized fields, or Observation with unrecognized category/LOINC) — the exception message explains why.
import olira

olira.init(api_key="YOUR_API_KEY")
result = olira.log_fhir(
    patient_id="8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
    resource={
        "resourceType": "Observation",
        "id": "bp-example",
        "status": "final",
        "category": [{
            "coding": [{
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "code": "vital-signs",
            }],
        }],
        "code": {
            "coding": [{
                "system": "http://loinc.org",
                "code": "85354-9",
                "display": "Blood pressure panel",
            }],
        },
        "subject": {"reference": "Patient/example"},
        "effectiveDateTime": "2026-05-01T10:00:00Z",
        "component": [
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8480-6"}]},
                "valueQuantity": {"value": 120, "unit": "mmHg"},
            },
            {
                "code": {"coding": [{"system": "http://loinc.org", "code": "8462-4"}]},
                "valueQuantity": {"value": 80, "unit": "mmHg"},
            },
        ],
    },
)
print(result.accepted, result.failed)
BatchResult(accepted=1, failed=0, errors=[])