Create FHIR resource from text and store it

POST/tools/lang2fhir-and-create

Converts natural language to FHIR resource and optionally stores it in a FHIR server

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

resourcestringrequired

Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile.

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

Natural language text to convert to FHIR resource

providerstring (uuid)optional

FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)

Returns  

Successfully created FHIR resource

Response fields

fhir_resourceobjectoptional

The created FHIR resource

fhir_idstringoptional

ID of the resource in the FHIR server (if successfully stored)

successbooleanoptional
messagestringoptional

Status message

POSTRequest
curl -X POST 'https://experiment.app.pheno.ml/tools/lang2fhir-and-create' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "resource": "condition-encounter-diagnosis",
  "text": "Patient John Doe has severe asthma with acute exacerbation",
  "provider": "550e8400-e29b-41d4-a716-446655440000"
}'
200 OKResponse
{
  "fhir_resource": {
    "resourceType": "Condition",
    "id": "condition-123",
    "code": {
      "coding": [
        {
          "system": "http://snomed.info/sct",
          "code": "195967001",
          "display": "Asthma"
        }
      ]
    },
    "subject": {
      "reference": "Patient/patient-123",
      "display": "John Doe"
    }
  },
  "fhir_id": "condition-123",
  "success": true,
  "message": "Successfully created FHIR resource"
}