Extract and store multiple FHIR resources

POST/tools/lang2fhir-and-create-multi

Extracts multiple FHIR resources from natural language text and stores them in a FHIR server. Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types. Resources are linked with proper references and submitted as a transaction bundle. For FHIR servers that don't auto-resolve urn:uuid references, this endpoint will automatically resolve them via PUT requests after the initial bundle creation.

RequiresBearerauthentication

Header parameters

X-Phenoml-On-Behalf-Ofstringoptional

Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}

X-Phenoml-Fhir-Providerstringoptional

Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.

Body parameters

textstringrequired

Natural language text containing multiple clinical concepts to extract

versionstringoptionaldefault R4

FHIR version to use

providerstringrequired

FHIR provider ID or name

Returns  

Successfully created FHIR resources

Response fields

successbooleanoptional

Whether the resources were created successfully

messagestringoptional

Status message

response_bundleobjectoptional

FHIR transaction-response Bundle from the server with resolved resource IDs

resourceTypestringoptional
typestringoptional
entryobject[]optional
resource_infoobject[]optional

Metadata about created resources (temp IDs, types, descriptions)

tempIdstringoptional

Original temporary UUID

resourceTypestringoptional

FHIR resource type

descriptionstringoptional

Text excerpt this resource was extracted from

POSTRequest
curl -X POST 'https://experiment.app.pheno.ml/tools/lang2fhir-and-create-multi' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "John Smith, 45-year-old male, diagnosed with Type 2 Diabetes. Prescribed Metformin 500mg twice daily.",
  "version": "R4",
  "provider": "medplum"
}'
200 OKResponse
{
  "success": true,
  "message": "Successfully created FHIR resources",
  "response_bundle": {
    "resourceType": "Bundle",
    "type": "transaction-response",
    "entry": [
      {}
    ]
  },
  "resource_info": [
    {
      "tempId": "urn:uuid:patient-abc123",
      "resourceType": "Patient",
      "description": "John Smith, 45-year-old male"
    }
  ]
}