Analyze text for patient cohort criteria

POST/cohort

Converts natural language text into structured FHIR search queries for patient cohort analysis

RequiresBearerauthentication

Body parameters

textstringrequired

Natural language text describing patient cohort criteria

Returns  

Successfully analyzed cohort criteria

Response fields

successbooleanoptional

Whether the cohort analysis was successful

messagestringoptional

Human-readable message about the analysis result

queriesobject[]optional

Array of search concepts converted to FHIR search queries

resource_typestringoptional

The FHIR resource type for this search concept

search_paramsstringoptional

FHIR search parameters in standard format

conceptstringoptional

The original concept description

excludebooleanoptional

Whether this concept should be excluded from the search

POSTRequest
# Get authentication token
PHENOML_TOKEN=$(curl -X POST "https://experiment.app.pheno.ml/v2/auth/token" \
  -u "$PHENOML_CLIENT_ID:$PHENOML_CLIENT_SECRET" \
  | jq -r '.access_token')

curl -X POST "https://experiment.app.pheno.ml/cohort" \
  -H "Authorization: Bearer $PHENOML_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "female patients over 65 with diabetes but not hypertension"
}'
200 OKExample Response
{
  "success": true,
  "message": "Cohort analysis completed successfully. Generated 3 search queries from 3 concepts.",
  "queries": [
    {
      "resource_type": "Patient",
      "search_params": "gender=female&birthdate=le1959-01-01",
      "concept": "female patients over 65",
      "exclude": false
    },
    {
      "resource_type": "Condition",
      "search_params": "code=44054006",
      "concept": "diabetes",
      "exclude": false
    },
    {
      "resource_type": "Condition",
      "search_params": "code=38341003",
      "concept": "hypertension",
      "exclude": true
    }
  ]
}