Extract multiple FHIR resources from text
/lang2fhir/create/multiAnalyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle. Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text. Resources are linked with proper references (e.g., Conditions reference the Patient).
Patient identifier handling. US Core requires Patient.identifier (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with system: "urn:phenoml:lang2fhir-generated-id" and a UUID value so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
Body parameters
Natural language text containing multiple clinical concepts to extract
FHIR version to use
Optional FHIR provider name for provider-specific profiles
Partial context for the patient the document is primarily about. This is not a complete FHIR Patient resource. Lang2FHIR uses the available context to identify a generated primary Patient reliably. An identifier supplied here is added to that Patient; when no Patient is generated, it is used in logical references on generated clinical resources.
Business identifier for the document's primary patient. When Lang2FHIR identifies that Patient in generated output, it adds this identifier to the Patient's identifier list (preserving existing identifiers). If no Patient is generated, Lang2FHIR uses it in logical references on generated clinical resources. Supply the patient-level identifier (not an order or specimen identifier).
Identifier system (namespace) for the patient identifier.
Identifier value for the patient within that system.
The known portions of the primary patient's name. Provide a non-empty family name or at least one non-empty given name.
Family name.
Given names. Matching succeeds when a generated name has a supplied given name.
Complete date of birth in YYYY-MM-DD format.
Administrative gender. This corroborates another match but does not identify a patient alone.
malefemaleotherunknownBusiness identifier for the document's primary patient. When Lang2FHIR identifies that Patient in generated output, it adds this identifier to the Patient's identifier list (preserving existing identifiers). If no Patient is generated, Lang2FHIR uses it in logical references on generated clinical resources. Supply the patient-level identifier (not an order or specimen identifier).
Identifier system (namespace) for the patient identifier.
Identifier value for the patient within that system.
Custom Implementation Guide name. When specified, profiles from this IG are included alongside the default profiles during resource detection. Default profiles are always the base layer; custom IG profiles are additive.
Deprecated; use the default 'standard' value. This field will be removed in a future release. 'standard' runs detection once; 'deep' runs detection multiple times for higher recall.
standarddeepFHIR validation method to apply to the generated bundle. 'none' skips validation (default). 'check' runs the bundle through a FHIR structure validator and includes the results in the response. 'fix' runs validation and attempts to auto-correct errors using an LLM (up to 3 validation passes). The response includes results from each pass. Warning: 'fix' can significantly increase latency due to multiple LLM and validation round-trips.
nonecheckfixOpt-in faithfulness audit (honored by /lang2fhir/create/multi and /lang2fhir/document/multi). For each selected resource type an LLM checks whether selected dates and clinical code concepts are actually supported by the full source document. An unsupported individual coding is removed when another coding remains in its concept. Resources with an unsupported structural field, a profile-required coding, or no coding remaining in an affected concept, are pulled out of the returned bundle and reported under resource_review in the response.
The resource types to audit and which date or clinical code field kinds to check.
FHIR resourceType to audit (e.g. Condition, Procedure, Observation, Encounter, MedicationRequest), matched against each generated resource's resourceType. Patient is not supported.
Field kinds to check for this resource type. Defaults to ["dates"] when omitted; use "codes" to audit clinical code concepts.
Successfully extracted FHIR resources
Response fields
Whether extraction was successful
Status message
FHIR transaction Bundle containing all extracted resources
Summary of extracted resources
Temporary UUID for the resource
FHIR resource type
Context-enriched rewritten text excerpt for this resource
Verbatim text excerpt from the original clinical document
Split classification id assigned to this resource by the /lang2fhir/document/multi endpoint. Omitted when the resource came only from ungrouped pages or raw-text create/multi.
1-indexed source document page number(s) this resource was extracted from. Populated only by the /lang2fhir/document/multi endpoint; omitted when the source page could not be determined (e.g. raw-text create/multi, or a resource with no verbatim source text).
FHIR validation results. Present when validation_method is 'check' or 'fix'. Contains results from each validation pass. For 'check', there is one pass. For 'fix', there may be up to 3 passes as the system attempts auto-correction.
Results from each validation pass, in chronological order
Validation issues found in this pass
Validation statistics for this pass
Whether validation errors were successfully fixed by the LLM. Always false for 'check' mode. For 'fix' mode, true if errors were resolved and the returned bundle is the corrected version.
Total number of validation passes run (1 for check, 1-3 for fix)
Human-readable summary of the validation outcome
Present when resource_review was requested and at least one resource was quarantined or safely remediated. The returned bundle is authoritative and contains the post-review representation of every retained resource.
Resources pulled from the bundle because an unsupported finding could not be safely repaired.
The urn:uuid of the flagged resource (its former bundle fullUrl).
The full generated FHIR resource that was pulled from the bundle.
The findings that caused the resource to be quarantined.
Resources retained in the bundle after unsupported codings were safely removed.
The urn:uuid of the remediated resource (its bundle fullUrl).
Findings for fields in the pre-remediation resource that caused this action.