Study order

DSP study orders are semantically ambiguous — they can mean 'order a diagnostic study' (cardiology, sleep, EEG) or 'enroll the patient in a research study'. The IG routes by DSP intent + order_data shape. Diagnostic studies are ServiceRequest; research enrollments are ResearchSubject.

DSP content_type

order.study

FHIR target

ServiceRequest (category=study) or ResearchSubject + ResearchStudy

Routing rule

DSP signalFHIR targetRationale
Order names a diagnostic protocol (polysomnogram, Holter, EEG, stress test)ServiceRequest (category=study)It's an ordered procedure that produces a report. If it produces images, ImagingStudy is the result, not the order.
Order references a study_id / protocol identifier and an enrollment intentResearchSubjectResearchStudyTrue clinical-trial enrollment; distinct operational resource set.
Genomic / specialized study (pharmacogenomic panel)ServiceRequest (category=study) with a genomics profileTreat like a lab order; result lands as Observation + MolecularSequence.

Field-by-field (diagnostic study path)

DSPFHIR R4Notes
type: STUDY_ORDERServiceRequest.category = studyIG CodeSystem order-category, code study. Bind ServiceRequest.code to the specific study protocol (LOINC or SNOMED).
order_data.study_codecodeLOINC for cardiac/sleep studies (e.g. 28633-6 polysomnogram); SNOMED 252465000 for echocardiogram etc.
order_data.modalitycategory (second coding) or extensionCardiology, neurology, sleep lab — helps routing to a specialty queue.
order_data.prioritypriority
order_data.scheduled_foroccurrenceDateTime
order_data.preparationpatientInstruction"NPO after midnight", "hold beta blockers 24h", etc.
reasonreasonCode / reasonReference

Side-by-side example (diagnostic study)

DSP

{
  "id": "study-001",
  "type": "STUDY_ORDER",
  "context": { "content_type": "order.study" },
  "description": "In-lab polysomnogram to evaluate suspected OSA",
  "intent": "order",
  "reason": "Witnessed apneas; daytime somnolence",
  "provenance": [71, 73],
  "order_data": {
    "study_code": "28633-6",
    "study_code_system": "LOINC",
    "modality": "sleep",
    "preparation": "Avoid caffeine and alcohol on day of study"
  }
}

FHIR R4 (DSP-FHIR profile)

{
  "resourceType":"ServiceRequest",
  "status":"active","intent":"order",
  "category":[
    {"coding":[{"system":"https://dsp-fhir.org/CodeSystem/order-category","code":"study"}]},
    {"coding":[{"system":"https://dsp-fhir.org/CodeSystem/study-modality","code":"sleep"}]}
  ],
  "code":{"coding":[{"system":"http://loinc.org","code":"28633-6","display":"Sleep study panel"}]},
  "subject":{"reference":"Patient/pat-67890"},
  "encounter":{"reference":"Encounter/enc-12345"},
  "patientInstruction":"Avoid caffeine and alcohol on day of study",
  "reasonCode":[{"text":"Witnessed apneas; daytime somnolence"}]
}

Side-by-side example (research enrollment path)

DSP

{
  "id": "study-002",
  "type": "STUDY_ORDER",
  "context": { "content_type": "order.study" },
  "description": "Enroll patient in PROMISE-HF clinical trial",
  "intent": "order",
  "order_data": {
    "study_id": "NCT05123456",
    "study_title": "PROMISE-HF: Precision Therapy in Heart Failure",
    "enrollment_date": "2026-05-01"
  }
}

FHIR R4 (two resources)

// Referenced study (may pre-exist)
{
  "resourceType":"ResearchStudy",
  "id":"promise-hf",
  "status":"active",
  "identifier":[{"system":"https://clinicaltrials.gov","value":"NCT05123456"}],
  "title":"PROMISE-HF: Precision Therapy in Heart Failure"
}

// Patient enrollment
{
  "resourceType":"ResearchSubject",
  "status":"candidate",
  "study":{"reference":"ResearchStudy/promise-hf"},
  "individual":{"reference":"Patient/pat-67890"},
  "period":{"start":"2026-05-01"}
}

DSP → FHIR mapping

Routing-split map — the FML below covers the diagnostic-study branch. The research-enrollment branch is sketched as a comment.

// Routing-split map. Study orders with a clinical-trial registry id
// (NCT-style study_id) route to ResearchSubject+ResearchStudy; otherwise
// to ServiceRequest(category=study). This map handles the diagnostic branch.

map "https://dsp-fhir.org/StructureMap/DspStudyOrderToServiceRequest" = "DspStudyOrderToServiceRequest"

uses "https://dsp-fhir.org/StructureDefinition/DspResource" alias DspResource as source
uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target

group DspStudyOrderToServiceRequest(source src : DspResource, target tgt : ServiceRequest) {
  src.id as id -> tgt.id = id;
  src -> tgt.status = 'active';
  src -> tgt.intent = 'order';
  src -> tgt.category as cat, cat.coding as co,
    co.system = 'https://dsp-fhir.org/CodeSystem/dsp-order-category',
    co.code = 'study' "category";

  src.payload as p then {
    p.study_type as st -> tgt.code as code, code.text = st "code-text";
    p.protocol as pr -> tgt.instantiatesUri = pr "protocol";
  };

  src.confidence as conf -> tgt.extension as ext then {
    conf -> ext.url = 'https://dsp-fhir.org/StructureDefinition/dsp-confidence-score',
            ext.value = create('decimal') as v, v.value = conf;
  } "confidence";
}

// Research enrollment branch (sketch):
// map "https://dsp-fhir.org/StructureMap/DspStudyOrderToResearchSubject"
//   - ResearchSubject.study -> ResearchStudy(identifier=NCT...)
//   - ResearchSubject.status = 'candidate'

FHIR → DSP (canonical $graphql read)

DSP STUDY_ORDER routes to two FHIR resource types. The reader runs the matching query and dispatches to the right adapter.

Canonical query (diagnostic branch — ServiceRequest)

query DspStudyOrder($id: ID!) {
  ServiceRequest(id: $id) {
    id status intent priority occurrenceDateTime
    category { coding { system code display } }
    code { text coding { system code display } }
    patientInstruction
    reasonCode { text }
    reasonReference { reference }
    instantiatesUri

    confidence: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-confidence-score") {
      valueDecimal
    }
    turnRefs: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-transcript-turn-ref") {
      transcript: extension(url: "transcript") { valueReference { reference } }
      turn:       extension(url: "turn")       { valueInteger }
    }
  }
}

Canonical query (research branch — ResearchSubject)

query DspStudyEnrollment($id: ID!) {
  ResearchSubject(id: $id) {
    id status
    period { start end }
    individual { reference }
    study {
      reference
      resource {
        ... on ResearchStudy {
          id title
          identifier { system value }
        }
      }
    }
  }
}

DSP reconstruction adapter

function toDspStudyOrder(r) {
  if (r.__typename === 'ResearchSubject' || r.individual) {
    const study = r.study?.resource;
    return {
      id: r.id,
      type: 'STUDY_ORDER',
      intent: 'order',
      order_data: {
        study_id:        study?.identifier?.find(i => i.system?.includes('clinicaltrials'))?.value,
        study_title:     study?.title,
        enrollment_date: r.period?.start,
        enrollment_status: r.status,
      },
    };
  }
  // Diagnostic branch
  const turnRefs = r.turnRefs ?? [];
  return {
    id: r.id,
    type: 'STUDY_ORDER',
    intent: r.intent,
    description: r.code?.text,
    reason: r.reasonCode?.[0]?.text,
    order_data: {
      study_code:        r.code?.coding?.[0]?.code,
      study_code_system: r.code?.coding?.[0]?.system,
      modality:          r.category?.find(c => c.coding?.[0]?.system?.includes('study-modality'))?.coding?.[0]?.code,
      priority:          r.priority,
      scheduled_for:     r.occurrenceDateTime,
      preparation:       r.patientInstruction,
      protocol:          r.instantiatesUri,
    },
    confidence_score: r.confidence?.[0]?.valueDecimal,
    provenance:       turnRefs.map(t => t.turn?.valueInteger),
    transcript_ref:   turnRefs[0]?.transcript?.valueReference?.reference,
  };
}
No data loss. The routing split is recovered from the FHIR resource type; each branch's fields land natively.

SQL-on-FHIR v2 ViewDefinitions that flatten every field above — including DSP extensions — into a tabular projection. Runnable as-is on any spec-conformant engine (Pathling, sof-exec, Aidbox SQL-on-FHIR, Databricks). See the SQL-on-FHIR v2 spec. These ViewDefinitions also ship as JSON in the IG zip.

dsp_service_request_study — DSP Study (ServiceRequest)

Flattens DSP dsp study (servicerequest) orders. Filtered by category=study.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-service-request-study",
  "name": "dsp_service_request_study",
  "title": "DSP Study (ServiceRequest)",
  "status": "draft",
  "description": "Flattens DSP dsp study (servicerequest) orders. Filtered by category=study.",
  "resource": "ServiceRequest",
  "fhirVersion": [
    "4.0.1"
  ],
  "where": [
    {
      "path": "category.coding.where(code='study').exists()"
    }
  ],
  "select": [
    {
      "column": [
        {
          "name": "id",
          "path": "id",
          "type": "id",
          "description": "Server-assigned logical id."
        },
        {
          "name": "version_id",
          "path": "meta.versionId",
          "type": "id",
          "description": "FHIR version id (drives NEW/UPDATED classification)."
        },
        {
          "name": "last_updated",
          "path": "meta.lastUpdated",
          "type": "instant",
          "description": "Instant of last mutation."
        },
        {
          "name": "meta_source",
          "path": "meta.source",
          "type": "uri"
        },
        {
          "name": "payload_version",
          "path": "meta.tag.where(system='https://dsp-fhir.org/CodeSystem/payload-version').code.first()",
          "type": "code",
          "description": "DSP payload version this resource was last emitted under."
        },
        {
          "name": "confidence_score",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/confidence-score').value.ofType(decimal)",
          "type": "decimal",
          "description": "DSP confidence (0..1)."
        },
        {
          "name": "transcript_ref",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('transcript').value.ofType(Reference).reference",
          "type": "string",
          "description": "DocumentReference/<id>/_history/<v> that pins the transcript version for turn indices."
        },
        {
          "name": "turn_indices",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('turn').value.ofType(integer)",
          "type": "integer",
          "collection": true,
          "description": "Turn indices joined by $ground into transcript content."
        },
        {
          "name": "spoken_forms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/spoken-forms').extension('form').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "search_terms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/search-terms').extension('term').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "status",
          "path": "status",
          "type": "code"
        },
        {
          "name": "intent",
          "path": "intent",
          "type": "code"
        },
        {
          "name": "priority",
          "path": "priority",
          "type": "code"
        },
        {
          "name": "subject_patient_id",
          "path": "subject.reference.substring(8)",
          "type": "string"
        },
        {
          "name": "encounter_id",
          "path": "encounter.reference.substring(10)",
          "type": "string"
        },
        {
          "name": "authored_on",
          "path": "authoredOn",
          "type": "dateTime"
        },
        {
          "name": "requester_practitioner_id",
          "path": "requester.reference.where($this.startsWith('Practitioner/')).substring(13).first()",
          "type": "string"
        },
        {
          "name": "code_system",
          "path": "code.coding.system.first()",
          "type": "uri"
        },
        {
          "name": "code",
          "path": "code.coding.code.first()",
          "type": "code"
        },
        {
          "name": "code_display",
          "path": "code.coding.display.first()",
          "type": "string"
        },
        {
          "name": "code_text",
          "path": "code.text",
          "type": "string"
        },
        {
          "name": "reason_code_text",
          "path": "reasonCode.text.first()",
          "type": "string"
        },
        {
          "name": "reason_reference",
          "path": "reasonReference.reference.first()",
          "type": "string"
        },
        {
          "name": "body_site_code",
          "path": "bodySite.coding.code.first()",
          "type": "code"
        },
        {
          "name": "study_reference",
          "path": "supportingInfo.reference.first()",
          "type": "string"
        }
      ]
    }
  ]
}

dsp_research_subject — DSP ResearchSubject

Flattens DSP study enrollment as a ResearchSubject.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-research-subject",
  "name": "dsp_research_subject",
  "title": "DSP ResearchSubject",
  "status": "draft",
  "description": "Flattens DSP study enrollment as a ResearchSubject.",
  "resource": "ResearchSubject",
  "fhirVersion": [
    "4.0.1"
  ],
  "select": [
    {
      "column": [
        {
          "name": "id",
          "path": "id",
          "type": "id",
          "description": "Server-assigned logical id."
        },
        {
          "name": "version_id",
          "path": "meta.versionId",
          "type": "id",
          "description": "FHIR version id (drives NEW/UPDATED classification)."
        },
        {
          "name": "last_updated",
          "path": "meta.lastUpdated",
          "type": "instant",
          "description": "Instant of last mutation."
        },
        {
          "name": "meta_source",
          "path": "meta.source",
          "type": "uri"
        },
        {
          "name": "payload_version",
          "path": "meta.tag.where(system='https://dsp-fhir.org/CodeSystem/payload-version').code.first()",
          "type": "code",
          "description": "DSP payload version this resource was last emitted under."
        },
        {
          "name": "confidence_score",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/confidence-score').value.ofType(decimal)",
          "type": "decimal",
          "description": "DSP confidence (0..1)."
        },
        {
          "name": "transcript_ref",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('transcript').value.ofType(Reference).reference",
          "type": "string",
          "description": "DocumentReference/<id>/_history/<v> that pins the transcript version for turn indices."
        },
        {
          "name": "turn_indices",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('turn').value.ofType(integer)",
          "type": "integer",
          "collection": true,
          "description": "Turn indices joined by $ground into transcript content."
        },
        {
          "name": "spoken_forms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/spoken-forms').extension('form').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "search_terms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/search-terms').extension('term').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "status",
          "path": "status",
          "type": "code"
        },
        {
          "name": "subject_patient_id",
          "path": "individual.reference.substring(8)",
          "type": "string"
        },
        {
          "name": "study_id",
          "path": "study.reference.substring(14)",
          "type": "string",
          "description": "Strip 'ResearchStudy/' prefix."
        },
        {
          "name": "assigned_arm",
          "path": "assignedArm",
          "type": "string"
        },
        {
          "name": "actual_arm",
          "path": "actualArm",
          "type": "string"
        },
        {
          "name": "period_start",
          "path": "period.start",
          "type": "dateTime"
        },
        {
          "name": "period_end",
          "path": "period.end",
          "type": "dateTime"
        },
        {
          "name": "consent_ref",
          "path": "consent.reference",
          "type": "string"
        }
      ]
    }
  ]
}

dsp_research_study — DSP ResearchStudy

Flattens the ResearchStudy metadata DSP references for trial enrollment.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-research-study",
  "name": "dsp_research_study",
  "title": "DSP ResearchStudy",
  "status": "draft",
  "description": "Flattens the ResearchStudy metadata DSP references for trial enrollment.",
  "resource": "ResearchStudy",
  "fhirVersion": [
    "4.0.1"
  ],
  "select": [
    {
      "column": [
        {
          "name": "id",
          "path": "id",
          "type": "id",
          "description": "Server-assigned logical id."
        },
        {
          "name": "version_id",
          "path": "meta.versionId",
          "type": "id",
          "description": "FHIR version id (drives NEW/UPDATED classification)."
        },
        {
          "name": "last_updated",
          "path": "meta.lastUpdated",
          "type": "instant",
          "description": "Instant of last mutation."
        },
        {
          "name": "meta_source",
          "path": "meta.source",
          "type": "uri"
        },
        {
          "name": "payload_version",
          "path": "meta.tag.where(system='https://dsp-fhir.org/CodeSystem/payload-version').code.first()",
          "type": "code",
          "description": "DSP payload version this resource was last emitted under."
        },
        {
          "name": "confidence_score",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/confidence-score').value.ofType(decimal)",
          "type": "decimal",
          "description": "DSP confidence (0..1)."
        },
        {
          "name": "transcript_ref",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('transcript').value.ofType(Reference).reference",
          "type": "string",
          "description": "DocumentReference/<id>/_history/<v> that pins the transcript version for turn indices."
        },
        {
          "name": "turn_indices",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/transcript-turn-refs').extension('turn').value.ofType(integer)",
          "type": "integer",
          "collection": true,
          "description": "Turn indices joined by $ground into transcript content."
        },
        {
          "name": "spoken_forms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/spoken-forms').extension('form').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "search_terms",
          "path": "extension('https://dsp-fhir.org/StructureDefinition/search-terms').extension('term').value.ofType(string)",
          "type": "string",
          "collection": true
        },
        {
          "name": "status",
          "path": "status",
          "type": "code"
        },
        {
          "name": "title",
          "path": "title",
          "type": "string"
        },
        {
          "name": "nct_id",
          "path": "identifier.where(system='http://clinicaltrials.gov').value.first()",
          "type": "string"
        },
        {
          "name": "phase_code",
          "path": "phase.coding.code.first()",
          "type": "code"
        },
        {
          "name": "primary_purpose_code",
          "path": "primaryPurposeType.coding.code.first()",
          "type": "code"
        },
        {
          "name": "sponsor_org_id",
          "path": "sponsor.reference.substring(13)",
          "type": "string"
        },
        {
          "name": "start_date",
          "path": "period.start",
          "type": "dateTime"
        },
        {
          "name": "end_date",
          "path": "period.end",
          "type": "dateTime"
        }
      ]
    }
  ]
}
Disambiguation. DSP 1.0 does not (as of the spec revision the IG tracks) distinguish diagnostic studies from research enrollments structurally. The IG routes on the presence of a study_id matching a clinical-trial registry. Producers SHOULD emit the research variant with an explicit trial_registry marker to remove ambiguity.