Create FHIR resource from text

POST/lang2fhir/create

Converts natural language text into a structured FHIR resource.

Patient identifier handling. When generating a patient (or patient-canvas) resource, 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 resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.

RequiresBearerauthentication

Body parameters

versionstringrequireddefault R4

FHIR version to use

resourcestringrequired

Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. Recommended to use the supported US Core Profiles for validated results but you can also use any custom profile you've uploaded (if you're a develop or launch customer)

autoappointmentcondition-encounter-diagnosismedicationrequestcareplancondition-problems-health-concernscoverageencounterobservation-clinical-resultobservation-labpatientprocedurequestionnairequestionnaireresponseservicerequestsimple-observationvital-signs
textstringrequired

Natural language text to convert

Returns  

Successfully created FHIR resource

Response fields

resourceTypestringoptional
clinicalStatusobjectoptional
codingarray<object>optional
systemstringoptional
codestringoptional
codeobjectoptional
codingarray<object>optional
systemstringoptional
codestringoptional
displaystringoptional
textstringoptional
severityobjectoptional
codingarray<object>optional
systemstringoptional
codestringoptional
displaystringoptional
POSTRequest
curl -X POST 'https://experiment.app.pheno.ml/lang2fhir/create' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "Patient has severe persistent asthma with acute exacerbation",
  "version": "R4",
  "resource": "condition-encounter-diagnosis"
}'
200 OKResponse
{
  "resourceType": "Condition",
  "clinicalStatus": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
        "code": "active"
      }
    ]
  },
  "code": {
    "coding": [
      {
        "system": "http://snomed.info/sct",
        "code": "195967001",
        "display": "Asthma"
      }
    ],
    "text": "Severe persistent asthma with acute exacerbation"
  },
  "severity": {
    "coding": [
      {
        "system": "http://snomed.info/sct",
        "code": "24484000",
        "display": "Severe"
      }
    ]
  }
}