Device order

DSP device orders cover DME (walker, CPAP, glucose monitor). FHIR's DeviceRequest is the order resource; Device is the physical/logical artifact; DeviceUseStatement (R4) records active use. R5 replaces DeviceUseStatement with DeviceUsage — we note the xver path.

DSP content_type

order.device

FHIR target

DeviceRequest (proposed) + Device + DeviceUseStatement (issued/in-use)

Field-by-field

DSPFHIR R4Notes
type: DEVICE_ORDERDeviceRequestR4-native. No ServiceRequest needed.
order_data.device_codecodeCodeableConcept or codeReferenceDeviceSNOMED (preferred), HCPCS for US billing context, or UDI via a Device reference.
order_data.quantityquantitye.g. 1 unit, 30-day supply.
order_data.body_siteExtension (no native R4 element on DeviceRequest; R5 adds it — xver candidate)Wrap in dsp-device-body-site extension for R4.
order_data.durationoccurrenceTiming.repeat.boundsDuration
order_data.parametersparameterRepeating code + value[x] — e.g. CPAP pressure, oxygen rate.
order_data.instructionpatientInstruction / note
reasonreasonCode / reasonReference

Side-by-side example

DSP

{
  "id": "dev-001",
  "type": "DEVICE_ORDER",
  "context": { "content_type": "order.device" },
  "description": "CPAP, auto-titrating, 5–15 cmH2O, for OSA",
  "intent": "order",
  "reason": "Obstructive sleep apnea, newly diagnosed",
  "reason_references": ["cond-005"],
  "provenance": [102, 104, 106],
  "order_data": {
    "device_code": "73211009",
    "device_code_system": "SNOMED",
    "parameters": [
      { "code": "pressure_min", "value": 5,  "unit": "cm[H2O]" },
      { "code": "pressure_max", "value": 15, "unit": "cm[H2O]" }
    ],
    "duration": { "value": 12, "unit": "month" }
  }
}

FHIR R4 (DSP-FHIR profile)

{
  "resourceType":"DeviceRequest",
  "status":"active","intent":"order",
  "subject":{"reference":"Patient/pat-67890"},
  "encounter":{"reference":"Encounter/enc-12345"},
  "codeCodeableConcept":{"coding":[{
    "system":"http://snomed.info/sct","code":"73211009","display":"Continuous positive airway pressure device"
  }]},
  "parameter":[
    { "code":{"text":"pressure-min"},
      "valueQuantity":{"value":5,"unit":"cmH2O","system":"http://unitsofmeasure.org","code":"cm[H2O]"}},
    { "code":{"text":"pressure-max"},
      "valueQuantity":{"value":15,"unit":"cmH2O","system":"http://unitsofmeasure.org","code":"cm[H2O]"}}
  ],
  "occurrenceTiming":{
    "repeat":{"boundsDuration":{"value":12,"unit":"mo","system":"http://unitsofmeasure.org","code":"mo"}}
  },
  "reasonReference":[{"reference":"Condition/cond-005"}]
}

DSP → FHIR mapping

Skeleton for DspDeviceOrder → DeviceRequest. Downstream DeviceUseStatement (R4) / DeviceUsage (R5) is out of scope for this map.

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

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

group DspDeviceOrderToDeviceRequest(source src : DspResource, target tgt : DeviceRequest) {
  src.id as id -> tgt.id = id;
  src -> tgt.status = 'active';
  src -> tgt.intent = 'order';

  src.payload as p then {
    p.device_code as dc -> tgt.code = create('CodeableConcept') as cc,
      cc.coding as co, co.system = 'http://snomed.info/sct', co.code = dc "device-code";
    p.device_description as dd -> tgt.code as code, code.text = dd "device-text";
    p.reason as r -> tgt.reasonCode as rc, rc.text = r "reason";
  };

  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";
}

// Note: R5 introduces DeviceUsage for adherence reporting. In R4 we use the
// DeviceRequest extension pattern documented in the IG (see /mapping/device).

FHIR → DSP (canonical $graphql read)

DeviceRequest carries device identity, parameters and timing natively; DSP body site is recovered from the cross-version dsp-device-body-site extension.

Canonical query

query DspDeviceOrder($id: ID!) {
  DeviceRequest(id: $id) {
    id status intent
    codeCodeableConcept { text coding { system code display } }
    codeReference { reference }
    quantityQuantity { value unit }
    occurrenceTiming {
      repeat {
        boundsDuration { value unit system code }
      }
    }
    parameter {
      code { text coding { system code display } }
      valueQuantity { value unit system code }
      valueCodeableConcept { coding { system code display } }
    }
    patientInstruction
    note { text }
    reasonCode { text }
    reasonReference { reference }

    bodySite: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-device-body-site") {
      valueCodeableConcept { coding { system code display } text }
    }
    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 toDspDeviceOrder(d) {
  const dur = d.occurrenceTiming?.repeat?.boundsDuration;
  const turnRefs = d.turnRefs ?? [];
  return {
    id: d.id,
    type: 'DEVICE_ORDER',
    intent: d.intent,
    description: d.codeCodeableConcept?.text ?? d.codeCodeableConcept?.coding?.[0]?.display,
    reason: d.reasonCode?.[0]?.text,
    reason_references: d.reasonReference?.map(r => r.reference),
    order_data: {
      device_code:        d.codeCodeableConcept?.coding?.[0]?.code,
      device_code_system: d.codeCodeableConcept?.coding?.[0]?.system,
      body_site:          d.bodySite?.[0]?.valueCodeableConcept?.coding?.[0]?.code,
      duration:           dur && { value: dur.value, unit: dur.code ?? dur.unit },
      quantity:           d.quantityQuantity?.value,
      parameters: d.parameter?.map(p => ({
        code:  p.code?.text ?? p.code?.coding?.[0]?.code,
        value: p.valueQuantity?.value ?? p.valueCodeableConcept?.coding?.[0]?.code,
        unit:  p.valueQuantity?.code ?? p.valueQuantity?.unit,
      })),
      instruction: d.patientInstruction,
    },
    confidence_score: d.confidence?.[0]?.valueDecimal,
    provenance:       turnRefs.map(t => t.turn?.valueInteger),
    transcript_ref:   turnRefs[0]?.transcript?.valueReference?.reference,
  };
}
No data loss. Parameters and body site are recoverable.

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_device_request — DSP Device order (DeviceRequest)

Flattens DSP device orders before fulfilment.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-device-request",
  "name": "dsp_device_request",
  "title": "DSP Device order (DeviceRequest)",
  "status": "draft",
  "description": "Flattens DSP device orders before fulfilment.",
  "resource": "DeviceRequest",
  "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": "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": "code_codeable_system",
          "path": "code.ofType(CodeableConcept).coding.system.first()",
          "type": "uri"
        },
        {
          "name": "code_codeable_code",
          "path": "code.ofType(CodeableConcept).coding.code.first()",
          "type": "code"
        },
        {
          "name": "code_codeable_display",
          "path": "code.ofType(CodeableConcept).coding.display.first()",
          "type": "string"
        },
        {
          "name": "code_reference_device_id",
          "path": "code.ofType(Reference).reference.substring(7)",
          "type": "string"
        },
        {
          "name": "occurrence_datetime",
          "path": "occurrence.ofType(dateTime)",
          "type": "dateTime"
        },
        {
          "name": "reason_reference",
          "path": "reasonReference.reference.first()",
          "type": "string"
        }
      ]
    }
  ]
}

dsp_device — DSP Device

Flattens a physical Device referenced by a DeviceRequest or DeviceUseStatement.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-device",
  "name": "dsp_device",
  "title": "DSP Device",
  "status": "draft",
  "description": "Flattens a physical Device referenced by a DeviceRequest or DeviceUseStatement.",
  "resource": "Device",
  "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": "manufacturer",
          "path": "manufacturer",
          "type": "string"
        },
        {
          "name": "model_number",
          "path": "modelNumber",
          "type": "string"
        },
        {
          "name": "serial_number",
          "path": "serialNumber",
          "type": "string"
        },
        {
          "name": "udi_carrier",
          "path": "udiCarrier.carrierHRF.first()",
          "type": "string"
        },
        {
          "name": "type_code",
          "path": "type.coding.code.first()",
          "type": "code"
        },
        {
          "name": "type_display",
          "path": "type.coding.display.first()",
          "type": "string"
        },
        {
          "name": "patient_id",
          "path": "patient.reference.substring(8)",
          "type": "string"
        }
      ]
    }
  ]
}

dsp_device_use_statement — DSP DeviceUseStatement

Flattens the statement that a patient is using a device (post-dispense signal).

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-device-use-statement",
  "name": "dsp_device_use_statement",
  "title": "DSP DeviceUseStatement",
  "status": "draft",
  "description": "Flattens the statement that a patient is using a device (post-dispense signal).",
  "resource": "DeviceUseStatement",
  "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": "subject.reference.substring(8)",
          "type": "string"
        },
        {
          "name": "device_id",
          "path": "device.reference.substring(7)",
          "type": "string"
        },
        {
          "name": "recorded_on",
          "path": "recordedOn",
          "type": "dateTime"
        },
        {
          "name": "timing_datetime",
          "path": "timing.ofType(dateTime)",
          "type": "dateTime"
        },
        {
          "name": "timing_period_start",
          "path": "timing.ofType(Period).start",
          "type": "dateTime"
        },
        {
          "name": "body_site_code",
          "path": "bodySite.coding.code.first()",
          "type": "code"
        },
        {
          "name": "reason_code",
          "path": "reasonCode.coding.code.first()",
          "type": "code"
        }
      ]
    }
  ]
}
R5 crosswalk. If the server needs to report ongoing use, R4's DeviceUseStatement is renamed to DeviceUsage in R5. The IG's R5-xver strategy reuses the element shapes verbatim so a later R5 upgrade is a rename, not a redesign. DeviceRequest.bodySite is R5-native — we carry it as an extension in R4 with the same URL the R5 element would use.