Activity order

DSP activity orders cover ambulation, mobility, exercise, activity restrictions (weight-bearing limits, no driving). These are plan-like items more than one-shot procedures. Prefer CarePlan.activity — a ServiceRequest is acceptable when the activity is literally a single scheduled event.

DSP content_type

order.activity

FHIR target

CarePlan.activity (primary) or ServiceRequest (category=activity)

Routing rule

DSP shapeFHIR target
Ongoing activity (ambulate 3×/day, no lifting >10 lb)CarePlan with activity.detail
Single-event activity (fitness test at next visit)ServiceRequest (category=activity)
Activity restriction (driving, work, sport)CarePlan.activity.detail with prohibited=true + Condition linkage for the underlying reason

Field-by-field (CarePlan.activity primary path)

DSPFHIR R4Notes
type: ACTIVITY_ORDERCarePlan.activityEach DSP activity order becomes one activity entry on the encounter-scoped CarePlan.
order_data.activity_codeactivity.detail.codeSNOMED: 52990006 ambulation, 103755000 exercise, etc.
order_data.prohibitedactivity.detail.prohibited (boolean)"No driving" → prohibited=true + code=driving.
order_data.frequencyactivity.detail.scheduledTimingSame Timing structure as Therapy.
order_data.quantity / durationactivity.detail.quantity + scheduledTiming.repeat.duration"Walk 10 min" → quantity=10 min.
order_data.restriction_limitactivity.detail.description + extension"No lifting >10 lb" — R4 has no structured lift-limit slot; narrative + DSP-FHIR weight-limit extension.
reason_referencesactivity.detail.reasonReference and/or CarePlan.addresses

Side-by-side example

DSP

{
  "id": "act-001",
  "type": "ACTIVITY_ORDER",
  "context": { "content_type": "order.activity" },
  "description": "No lifting greater than 10 pounds for 6 weeks; walk 20 minutes twice daily",
  "intent": "order",
  "reason": "Post-op lumbar discectomy recovery",
  "reason_references": ["cond-007"],
  "provenance": [88, 90],
  "order_data": {
    "items": [
      {
        "activity_code": "129006008",
        "activity_code_system": "SNOMED",
        "prohibited": true,
        "restriction_limit": { "value": 10, "unit": "[lb_av]" },
        "duration": { "value": 6, "unit": "week" }
      },
      {
        "activity_code": "52990006",
        "activity_code_system": "SNOMED",
        "quantity": { "value": 20, "unit": "min" },
        "frequency_per_day": 2
      }
    ]
  }
}

FHIR R4 (DSP-FHIR profile)

{
  "resourceType":"CarePlan",
  "status":"active","intent":"order",
  "subject":{"reference":"Patient/pat-67890"},
  "encounter":{"reference":"Encounter/enc-12345"},
  "addresses":[{"reference":"Condition/cond-007"}],
  "activity":[
    {
      "detail":{
        "kind":"ServiceRequest",
        "code":{"coding":[{"system":"http://snomed.info/sct","code":"129006008","display":"Lifting"}]},
        "status":"not-started",
        "prohibited":true,
        "description":"No lifting >10 lb for 6 weeks",
        "scheduledTiming":{"repeat":{"boundsDuration":{"value":6,"unit":"wk","system":"http://unitsofmeasure.org","code":"wk"}}},
        "extension":[
          { "url":"https://dsp-fhir.org/StructureDefinition/weight-limit",
            "valueQuantity":{"value":10,"unit":"lb","system":"http://unitsofmeasure.org","code":"[lb_av]"}}
        ]
      }
    },
    {
      "detail":{
        "kind":"ServiceRequest",
        "code":{"coding":[{"system":"http://snomed.info/sct","code":"52990006","display":"Ambulation"}]},
        "status":"not-started",
        "quantity":{"value":20,"unit":"min","system":"http://unitsofmeasure.org","code":"min"},
        "scheduledTiming":{"repeat":{"frequency":2,"period":1,"periodUnit":"d"}}
      }
    }
  ]
}

DSP → FHIR mapping

Skeleton for DspActivityOrder → CarePlan.activity[]. Per-activity confidence isn't expressible on activity.detail; callers needing it should emit standalone ServiceRequests and link via activity.reference (see callout below).

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

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

// DSP ACTIVITY_ORDER -> CarePlan.activity[] (multi-item).
// For one DSP order carrying multiple items (restrictions + active tasks),
// this map produces one CarePlan with one activity per item.
// Per-activity confidence/turn-refs is not supported on activity.detail -
// when needed, emit each item as a standalone ServiceRequest and reference it
// from activity.reference (see /mapping/activity).

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

  src.payload as p then {
    p.items as item -> tgt.activity as act, act.detail as d then {
      item.activity_code as code -> d.code as c, c.coding as co,
        co.system = 'http://snomed.info/sct', co.code = code "activity-code";
      item.prohibited as proh -> d.prohibited = proh "prohibited";
      item.description as desc -> d.description = desc "desc";
      item.quantity as q -> d.quantity as qty, qty.value = q "qty";
      item.frequency_per_day as freq -> d.scheduledTiming as tt, tt.repeat as rep,
        rep.frequency = freq, rep.period = 1, rep.periodUnit = 'd' "freq";
    };
  };
}

FHIR → DSP (canonical $graphql read)

Each DSP activity item lives under CarePlan.activity. The reader pulls the encounter-scoped CarePlan and reconstructs DSP's order_data.items[].

Canonical query

query DspActivityOrder($id: ID!) {
  CarePlan(id: $id) {
    id status intent
    addresses { reference }
    activity {
      detail {
        kind status prohibited
        code { coding { system code display } }
        description
        quantity { value unit system code }
        scheduledTiming {
          repeat {
            frequency period periodUnit
            boundsDuration { value unit system code }
          }
        }
        weightLimit: extension(url: "https://dsp-fhir.org/StructureDefinition/dsp-weight-limit") {
          valueQuantity { value unit system code }
        }
      }
      reference { reference }
    }

    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 toDspActivityOrder(p) {
  const turnRefs = p.turnRefs ?? [];
  return {
    id: p.id,
    type: 'ACTIVITY_ORDER',
    intent: p.intent,
    reason_references: p.addresses?.map(a => a.reference),
    order_data: {
      items: p.activity?.map(a => {
        const d  = a.detail;
        const r  = d?.scheduledTiming?.repeat;
        const wl = d?.weightLimit?.[0]?.valueQuantity;
        return {
          activity_code:        d?.code?.coding?.[0]?.code,
          activity_code_system: d?.code?.coding?.[0]?.system,
          prohibited:           d?.prohibited,
          description:          d?.description,
          quantity:             d?.quantity && { value: d.quantity.value, unit: d.quantity.code ?? d.quantity.unit },
          frequency_per_day:    r?.periodUnit === 'd' ? r?.frequency : undefined,
          duration:             r?.boundsDuration && { value: r.boundsDuration.value, unit: r.boundsDuration.code ?? r.boundsDuration.unit },
          restriction_limit:    wl && { value: wl.value, unit: wl.code ?? wl.unit },
          // Per-activity provenance lives on a sibling ServiceRequest if needed
          serviceRequestRef:    a.reference?.reference,
        };
      }) ?? [],
    },
    confidence_score: p.confidence?.[0]?.valueDecimal,
    provenance:       turnRefs.map(t => t.turn?.valueInteger),
    transcript_ref:   turnRefs[0]?.transcript?.valueReference?.reference,
  };
}
One known limitation, by design. CarePlan.activity.detail is a sub-record, not a full resource, so per-activity confidence/turn-refs cannot be carried on it. When DSP needs per-item provenance, the producer emits each item as a standalone ServiceRequest and links it via activity.reference; the adapter follows the reference and inherits the per-item metadata from there.
No data loss when the per-item ServiceRequest pattern is used. CarePlan-level confidence/turn-refs cover the order envelope.

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_care_plan_activity — DSP CarePlan activity (preferred)

One row per CarePlan.activity — the preferred home for DSP order.activity.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-care-plan-activity",
  "name": "dsp_care_plan_activity",
  "title": "DSP CarePlan activity (preferred)",
  "status": "draft",
  "description": "One row per CarePlan.activity — the preferred home for DSP order.activity.",
  "resource": "CarePlan",
  "fhirVersion": [
    "4.0.1"
  ],
  "select": [
    {
      "column": [
        {
          "name": "care_plan_id",
          "path": "id",
          "type": "id"
        },
        {
          "name": "encounter_id",
          "path": "encounter.reference.substring(10)",
          "type": "string"
        },
        {
          "name": "subject_patient_id",
          "path": "subject.reference.substring(8)",
          "type": "string"
        },
        {
          "name": "care_plan_status",
          "path": "status",
          "type": "code"
        },
        {
          "name": "care_plan_intent",
          "path": "intent",
          "type": "code"
        }
      ],
      "select": [
        {
          "forEach": "activity",
          "column": [
            {
              "name": "activity_kind",
              "path": "detail.kind",
              "type": "code"
            },
            {
              "name": "activity_status",
              "path": "detail.status",
              "type": "code"
            },
            {
              "name": "activity_code_system",
              "path": "detail.code.coding.system.first()",
              "type": "uri"
            },
            {
              "name": "activity_code",
              "path": "detail.code.coding.code.first()",
              "type": "code"
            },
            {
              "name": "activity_display",
              "path": "detail.code.coding.display.first()",
              "type": "string"
            },
            {
              "name": "activity_description",
              "path": "detail.description",
              "type": "string"
            },
            {
              "name": "activity_scheduled_period_start",
              "path": "detail.scheduled.ofType(Period).start",
              "type": "dateTime"
            },
            {
              "name": "activity_reason_ref",
              "path": "detail.reasonReference.reference.first()",
              "type": "string"
            },
            {
              "name": "reference_to_request",
              "path": "reference.reference",
              "type": "string",
              "description": "Populated when the activity references a separate ServiceRequest/Appointment."
            }
          ]
        }
      ]
    }
  ]
}

dsp_service_request_activity — DSP Activity order (ServiceRequest fallback)

Flattens DSP dsp activity order (servicerequest fallback) orders. Filtered by category=activity.

{
  "resourceType": "ViewDefinition",
  "url": "https://dsp-fhir.org/ViewDefinition/dsp-service-request-activity",
  "name": "dsp_service_request_activity",
  "title": "DSP Activity order (ServiceRequest fallback)",
  "status": "draft",
  "description": "Flattens DSP dsp activity order (servicerequest fallback) orders. Filtered by category=activity.",
  "resource": "ServiceRequest",
  "fhirVersion": [
    "4.0.1"
  ],
  "where": [
    {
      "path": "category.coding.where(code='activity').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": "activity_description",
          "path": "note.text.first()",
          "type": "string"
        }
      ]
    }
  ]
}
The one DSP type that collapses onto FHIR awkwardly. CarePlan.activity.detail is a compact sub-record, not a full request resource, so it lacks the confidence/provenance extension-context you get on first-class resources. If per-activity confidence or turn-refs matter to a consumer, emit each activity as a standalone ServiceRequest (category=activity) and reference it from CarePlan.activity.reference.