build_resource
Build a validated FHIR resource from flat fields, handling complex nesting like CodeableConcepts and Dosage. Returns success or issues for correction.
Instructions
Build a FHIR resource from flat fields and validate it. Call this instead of writing FHIR JSON by hand — it does the nesting (CodeableConcepts, Dosage) and returns {ok, resource} or {ok: false, issues} to correct. Supported resource_type values: Condition, MedicationStatement, Observation, AllergyIntolerance, Patient. Use a code returned by lookup_code, never an invented one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| unit | No | ||
| onset | No | ||
| value | No | ||
| gender | No | ||
| status | No | ||
| system | No | ||
| display | No | ||
| subject | No | ||
| dose_unit | No | ||
| birth_date | No | ||
| dose_value | No | ||
| dosage_text | No | ||
| resource_type | Yes | ||
| frequency_per_day | No | ||
| effective_datetime | No |