Imaging order
Imaging orders live on ServiceRequest with category=imaging. DSP's free-string modality/laterality/views need structured bindings via extensions for cross-system comparability.
order.imaging
ServiceRequest (category=imaging)
Field-by-field
| DSP | FHIR R4 | Notes |
|---|---|---|
type: IMAGING_ORDER | ServiceRequest.category = imaging | http://snomed.info/sct|363679005. |
description | ServiceRequest.code.text | |
order_data.imaging_modality (string "X-ray" / "MRI" / "CT") | Extension imaging-modality (coded) | Bind to DCM (http://dicom.nema.org/resources/ontology/DCM) — the DICOM controlled terminology FHIR code system. |
order_data.imaging_body_location | ServiceRequest.bodySite | Prefer SNOMED body structure codes. |
order_data.imaging_location_laterality | Extension bodysite-laterality on bodySite | right/left/bilateral (SNOMED). |
order_data.views | Extension imaging-views | |
order_data.contrast | Extension imaging-contrast | with / without / with-and-without. |
order_data.imaging_instructions | ServiceRequest.note.text | |
order_data.patient_instructions | ServiceRequest.patientInstruction |
Side-by-side example
DSP
{
"id": "f7d8e9a0b1c2d3e4f5g6h7i8j9k0l1m2",
"type": "IMAGING_ORDER",
"context": { "content_type": "order.imaging" },
"description": "Chest X-ray to evaluate shortness of breath",
"intent": "order",
"order_data": {
"imaging_modality": "X-ray",
"imaging_body_location": "chest",
"imaging_location_laterality": "bilateral",
"views": "2 view",
"contrast": "without contrast",
"imaging_instructions": "Standard PA and lateral views",
"patient_instructions": "No preparation required."
},
"confidence_score": 1.0
} FHIR R4 (DSP-FHIR profile)
{
"resourceType":"ServiceRequest",
"status":"active","intent":"order",
"category":[{"coding":[{"system":"http://snomed.info/sct","code":"363679005","display":"Imaging"}]}],
"code":{"text":"Chest X-ray 2 view without contrast"},
"bodySite":[{
"coding":[{"system":"http://snomed.info/sct","code":"51185008","display":"Thoracic structure"}],
"extension":[{"url":"https://dsp-fhir.org/StructureDefinition/bodysite-laterality","valueCode":"bilateral"}]
}],
"subject":{"reference":"Patient/pat-67890"},
"encounter":{"reference":"Encounter/enc-12345"},
"patientInstruction":"No preparation required.",
"note":[{"text":"Standard PA and lateral views"}],
"extension":[
{"url":"https://dsp-fhir.org/StructureDefinition/imaging-modality",
"valueCoding":{"system":"http://dicom.nema.org/resources/ontology/DCM","code":"CR","display":"Computed Radiography"}},
{"url":"https://dsp-fhir.org/StructureDefinition/imaging-views","valueString":"2 view"},
{"url":"https://dsp-fhir.org/StructureDefinition/imaging-contrast","valueCode":"without"},
{"url":"https://dsp-fhir.org/StructureDefinition/confidence-score","valueDecimal":1.0}
]
} DSP → FHIR mapping
Skeleton for DspImagingOrder → ServiceRequest(category=imaging).
map "https://dsp-fhir.org/StructureMap/DspImagingOrderToServiceRequest" = "DspImagingOrderToServiceRequest"
uses "https://dsp-fhir.org/StructureDefinition/DspOrderImagingResource" alias DspImgOrder as source
uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target
group DspImagingOrderToServiceRequest(source src : DspImgOrder, 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 = 'http://snomed.info/sct', co.code = '363679005',
co.display = 'Imaging' "category";
src.payload as p then {
p.modality as m -> tgt.extension as ext then {
m -> ext.url = 'https://dsp-fhir.org/StructureDefinition/dsp-imaging-modality',
ext.value = create('CodeableConcept') as cc, cc.text = m;
} "modality";
p.body_site as bs -> tgt.bodySite as bodyCc, bodyCc.text = bs "body-site";
p.laterality as lat -> tgt.bodySite as bodyCc, bodyCc.extension as ext then {
lat -> ext.url = 'https://dsp-fhir.org/StructureDefinition/dsp-bodysite-laterality',
ext.value = create('code') as v, v.value = lat;
} "laterality";
p.contrast as c -> tgt.extension as ext then {
c -> ext.url = 'https://dsp-fhir.org/StructureDefinition/dsp-imaging-contrast',
ext.value = create('code') as v, v.value = c;
} "contrast";
p.views as v -> tgt.extension as ext,
ext.url = 'https://dsp-fhir.org/StructureDefinition/dsp-imaging-views',
ext.value = create('string') as vs, vs.value = v "view";
};
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";
} FHIR → DSP (canonical $graphql read)
Standard FHIR $graphql selects every native ServiceRequest field and DSP-namespaced extension. The imaging-specific extensions (dsp-imaging-modality, dsp-imaging-views, dsp-imaging-contrast, dsp-bodysite-laterality) carry the structured codings the DSP wording can't recover by itself.
Canonical query
query DspImagingOrder($id: ID!) {
ServiceRequest(id: $id) {
id status intent
category { coding { system code display } }
code { text coding { system code display } }
bodySite {
coding { system code display }
text
laterality: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-bodysite-laterality") {
valueCode
}
}
note { text }
patientInstruction
reasonCode { text }
modality: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-imaging-modality") {
valueCoding { system code display }
}
views: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-imaging-views") {
valueString
}
contrast: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-imaging-contrast") {
valueCode
}
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 }
}
}
} DSP reconstruction adapter
function toDspImagingOrder(s) {
const body = s.bodySite?.[0];
const turnRefs = s.turnRefs ?? [];
return {
id: s.id,
type: 'IMAGING_ORDER',
intent: s.intent,
description: s.code?.text,
order_data: {
imaging_modality: s.modality?.[0]?.valueCoding?.display,
imaging_modality_code: s.modality?.[0]?.valueCoding?.code,
imaging_body_location: body?.text ?? body?.coding?.[0]?.display,
imaging_location_laterality: body?.laterality?.[0]?.valueCode,
views: s.views?.map(v => v.valueString).join(', '),
contrast: s.contrast?.[0]?.valueCode,
imaging_instructions: s.note?.map(n => n.text).join('\n'),
patient_instructions: s.patientInstruction,
},
reason: s.reasonCode?.[0]?.text,
confidence_score: s.confidence?.[0]?.valueDecimal,
provenance: turnRefs.map(t => t.turn?.valueInteger),
transcript_ref: turnRefs[0]?.transcript?.valueReference?.reference,
};
} dsp-imaging-* extensions — the original DSP free-text
is recoverable.
SQL-on-FHIR v2 ViewDefinition that flattens 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_imaging — DSP Imaging order (ServiceRequest)
Flattens DSP dsp imaging order (servicerequest) orders. Filtered by category=imaging.
{
"resourceType": "ViewDefinition",
"url": "https://dsp-fhir.org/ViewDefinition/dsp-service-request-imaging",
"name": "dsp_service_request_imaging",
"title": "DSP Imaging order (ServiceRequest)",
"status": "draft",
"description": "Flattens DSP dsp imaging order (servicerequest) orders. Filtered by category=imaging.",
"resource": "ServiceRequest",
"fhirVersion": [
"4.0.1"
],
"where": [
{
"path": "category.coding.where(code='imaging').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": "modality_code",
"path": "extension('https://dsp-fhir.org/StructureDefinition/dsp-imaging-modality').value.ofType(code)",
"type": "code"
},
{
"name": "contrast_used",
"path": "extension('https://dsp-fhir.org/StructureDefinition/dsp-imaging-contrast').value.ofType(boolean)",
"type": "boolean"
},
{
"name": "laterality_code",
"path": "bodySite.coding.where(system='http://snomed.info/sct').code.first()",
"type": "code"
}
]
}
]
}