Integrated Campaign Registry (ICR) Implementation Guide
0.1.0 - ci-build
Integrated Campaign Registry (ICR) Implementation Guide - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
{
"resourceType": "https://sql-on-fhir.org/ig/StructureDefinition/ViewDefinition",
"url": "https://icr.healthcampaigns.org/ViewDefinition/IcrCampaignTaskOutput",
"title": "ICR campaign task tallies per activity",
"description": "One row per ICRCampaignTask × activity tally (`treated-count` output): the\npeople treated or vaccinated at a visit, **per activity**. A visit that delivers\nseveral activities has no `Task.instantiatesCanonical` and one `treated-count`\nper activity, each naming its activity in the output's `campaign-activity`\nextension; a single-activity visit has one `treated-count` and its activity is\nthe Task's `instantiatesCanonical`. `activity` takes the output's activity, or\nthe Task's when the output names none; `activity_from` says which (`output` |\n`task`). Join to `IcrCampaignTask` on `task_id` for the visit, and to\n`IcrCampaignActivity` on `campaign_id` + `activity` for the activity's target.\nTasks with no `treated-count` have no rows.",
"name": "IcrCampaignTaskOutput",
"status": "draft",
"fhirVersion": [
"4.0.1"
],
"resource": "Task",
"where": [
{
"path": "basedOn.exists()",
"description": "Tasks that execute a campaign — the ICRCampaignTask profile"
}
],
"select": [
{
"column": [
{
"name": "task_id",
"path": "getResourceKey()",
"type": "id",
"description": "Join key to IcrCampaignTask"
},
{
"name": "campaign_id",
"path": "basedOn.first().getReferenceKey(CarePlan)",
"type": "string"
},
{
"name": "location_id",
"path": "location.getReferenceKey(Location)",
"type": "string",
"description": "Where the work happened — join key to the location registry"
},
{
"name": "for_group_id",
"path": "for.getReferenceKey(Group)",
"type": "string"
},
{
"name": "for_location_id",
"path": "for.getReferenceKey(Location)",
"type": "string"
},
{
"name": "status",
"path": "status",
"type": "code"
},
{
"name": "lineage",
"path": "extension('https://icr.healthcampaigns.org/StructureDefinition/data-lineage').value.ofType(code)",
"type": "code"
},
{
"name": "execution_start",
"path": "executionPeriod.start",
"type": "dateTime"
}
]
},
{
"unionAll": [
{
"forEach": "output.where(type.coding.where(system = 'https://icr.healthcampaigns.org/CodeSystem/icr-task-output-type-cs' and code = 'treated-count').exists() and extension('https://icr.healthcampaigns.org/StructureDefinition/campaign-activity').exists())",
"column": [
{
"name": "activity",
"path": "extension('https://icr.healthcampaigns.org/StructureDefinition/campaign-activity').value.ofType(canonical)",
"type": "canonical",
"description": "The activity this tally is for: the output's campaign-activity, else the Task's instantiatesCanonical"
},
{
"name": "activity_from",
"path": "'output'",
"type": "code",
"description": "output (the tally's campaign-activity) | task (Task.instantiatesCanonical)"
},
{
"name": "treated_count",
"path": "value.ofType(unsignedInt)",
"type": "unsignedInt",
"description": "People treated or vaccinated at the visit for this activity"
}
]
},
{
"column": [
{
"name": "activity",
"path": "instantiatesCanonical",
"type": "canonical"
},
{
"name": "activity_from",
"path": "'task'",
"type": "code"
}
],
"select": [
{
"forEach": "output.where(type.coding.where(system = 'https://icr.healthcampaigns.org/CodeSystem/icr-task-output-type-cs' and code = 'treated-count').exists() and extension('https://icr.healthcampaigns.org/StructureDefinition/campaign-activity').empty())",
"column": [
{
"name": "treated_count",
"path": "value.ofType(unsignedInt)",
"type": "unsignedInt"
}
]
}
]
}
]
}
]
}