Closed samkanga closed 2 years ago
Template 1
{
"identifier": "${planIdentifier}",
"version": "1",
"name": "${focus_status}-${focus_name}-${patient_name}_${patient_surname}-${currentDate}-${flag}",
"title": "${focus_status} - ${focus_name} - ${patient_name} ${patient_surname} - ${currentDate} - ${flag}",
"status": "draft",
"date": "${currentDate}",
"effectivePeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"useContext": [
{
"code": "interventionType",
"valueCodableConcept": "Dynamic-FI"
},
{
"code": "fiStatus",
"valueCodableConcept": "${focus_status}"
},
{
"code": "fiReason",
"valueCodableConcept": "Case Triggered"
},
{
"code": "opensrpEventId",
"valueCodableConcept": "${opensrpCaseClassificationEventId}"
},
{
"code": "caseNum",
"valueCodableConcept": "${case_number}"
},
{
"code": "taskGenerationStatus",
"valueCodableConcept": "internal"
}
],
"jurisdiction": [
{
"code": "${focus_id}"
}
],
"serverVersion": 0,
"goal": [
{
"id": "Case_Confirmation",
"description": "ยืนยันบ้านผู้ป่วย",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนผู้ป่วยที่ได้รับการยืนยัน",
"detail": {
"detailQuantity": {
"value": 1,
"comparator": ">=",
"unit": "case(s)"
}
},
"due": "${endDate}"
}
]
},
{
"id": "RACD_register_families",
"description": "ลงทะเบียนครัวเรือนและสมาชิกในครัวเรือน (100%) ภายในพื้นที่ปฏิบัติงาน",
"priority": "medium-priority",
"target": [
{
"measure": "ร้อยละของบ้าน สิ่งปลูกสร้างที่ได้ลงทะเบียนข้อมูลครัวเรือน",
"detail": {
"detailQuantity": {
"value": 100.0,
"comparator": ">=",
"unit": "%"
}
},
"due": "${endDate}"
}
]
},
{
"id": "RACD_Blood_Screening",
"description": "เจาะเลือดรอบบ้านผู้ป่วยในรัศมี 1 กิโลเมตร (100%)",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนผู้ที่ได้รับการเจาะโลหิต",
"detail": {
"detailQuantity": {
"value": 50.0,
"comparator": ">=",
"unit": "คน"
}
},
"due": "${endDate}"
}
]
},
{
"id": "BCC_Focus",
"description": "ให้สุขศึกษาในพื้นที่ปฏิบัติงานอย่างน้อย 1 ครั้ง",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนกิจกรรมการให้สุขศึกษา",
"detail": {
"detailQuantity": {
"value": 1.0,
"comparator": ">=",
"unit": "แห่ง"
}
},
"due": "${endDate}"
}
]
},
{
"id": "RACD_bednet_distribution",
"description": "แจกมุ้งทุกหลังคาเรือนในพื้นที่ปฏิบัติงาน (100%)",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนบ้าน/สิ่งปลูกสร้างที่ได้รับมุ้ง",
"detail": {
"detailQuantity": {
"value": 90.0,
"comparator": ">=",
"unit": "%"
}
},
"due": "${endDate}"
}
]
},
{
"id": "Larval_Dipping",
"description": "ดำเนินกิจกรรมจับลูกน้ำอย่างน้อย 3 แห่งในพื้นที่ปฏิบัติงาน",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนกิจกรรมการตักลูกน้ำ",
"detail": {
"detailQuantity": {
"value": 3.0,
"comparator": ">=",
"unit": "แห่ง"
}
},
"due": "${endDate}"
}
]
},
{
"id": "Mosquito_Collection",
"description": "กิจกรรมจับยุงกำหนดไว้อย่างน้อย 3 แห่ง",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนกิจกรรมการจับยุง",
"detail": {
"detailQuantity": {
"value": 3.0,
"comparator": ">=",
"unit": "แห่ง"
}
},
"due": "${endDate}"
}
]
}
],
"action": [
{
"identifier": "662d4bff-43cc-4f50-af1e-3bc86f8af253",
"prefix": 1,
"title": "การยืนยันบ้านผู้ป่วย",
"description": "ยืนยันบ้านผู้ป่วย",
"code": "Case Confirmation",
"timingPeriod": {
"start": "2021-09-13",
"end": "2021-09-23"
},
"reason": "Investigation",
"goalId": "Case_Confirmation",
"subjectCodableConcept": {
"text": "Jurisdiction"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Event is case details event",
"expression": "questionnaire = 'Case_Details'"
}
}
],
"definitionUri": "case_confirmation.json",
"type": "create"
},
{
"identifier": "${registerFamilyActionId}",
"prefix": 2,
"title": "ลงทะเบียนครัวเรือน",
"description": "ลงทะเบียนครัวเรือนและสมาชิกในครัวเรือน (100%) ภายในพื้นที่ปฏิบัติงาน",
"code": "RACD Register Family",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "RACD_register_families",
"subjectCodableConcept": {
"text": "Location"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Register_Structure event is submitted",
"expression": "questionnaire = 'Register_Structure' or questionnaire = 'Archive_Family'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Structure is residential or type does not exist",
"expression": "$this.is(FHIR.QuestionnaireResponse) or (($this.type.where(id='locationType').exists().not() or $this.type.where(id='locationType').text = 'Residential Structure') and $this.contained.exists().not())",
"subjectCodableConcept": {
"text": "Family"
}
}
},
{
"kind": "applicability",
"expression": {
"description": "Apply to residential structures in Register_Structure questionnaires",
"expression": "$this.is(FHIR.Location) or (questionnaire = 'Register_Structure' and $this.item.where(linkId='structureType').answer.value ='Residential Structure')"
}
}
],
"definitionUri": "family_register.json",
"type": "create"
},
{
"identifier": "${bloodScreeningActionId}",
"prefix": 3,
"title": "กิจกรรมการเจาะโลหิต",
"description": "เจาะเลือดรอบบ้านผู้ป่วยในรัศมี 1 กิโลเมตร (100%)",
"code": "Blood Screening",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "RACD_Blood_Screening",
"subjectCodableConcept": {
"text": "Person"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Family Registration or Family Member Registration event is submitted",
"expression": "questionnaire = 'Family_Registration' or questionnaire = 'Family_Member_Registration'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Person is older than 5 years or person associated with questionnaire response if older than 5 years",
"expression": "($this.is(FHIR.Patient) and $this.birthDate <= today() - 5 'years') or ($this.contained.where(Patient.birthDate <= today() - 5 'years').exists())"
}
}
],
"definitionUri": "blood_screening.json",
"type": "create"
},
{
"identifier": "${bccActionId}",
"prefix": 4,
"title": "กิจกรรมการให้สุขศึกษา",
"description": "ดำเนินกิจกรรมให้สุขศึกษา",
"code": "BCC",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "BCC_Focus",
"subjectCodableConcept": {
"text": "Jurisdiction"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Jurisdiction type location",
"expression": "Location.physicalType.coding.exists(code='jdn')"
}
}
],
"definitionUri": "behaviour_change_communication.json",
"type": "create"
},
{
"identifier": "${bednetDistributionActionId}",
"prefix": 5,
"title": "กิจกรรมสำรวจ/ชุบ/แจกมุ้ง",
"description": "แจกมุ้งทุกหลังคาเรือนในพื้นที่ปฏิบัติงาน (100%)",
"code": "Bednet Distribution",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "RACD_bednet_distribution",
"subjectCodableConcept": {
"text": "Location"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Family Registration event is submitted",
"expression": "questionnaire = 'Family_Registration'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Structure is residential or type does not exist",
"expression": "$this.is(FHIR.QuestionnaireResponse) or (($this.type.where(id='locationType').exists().not() or $this.type.where(id='locationType').text = 'Residential Structure') and $this.contained.exists())",
"subjectCodableConcept": {
"text": "Family"
}
}
}
],
"definitionUri": "bednet_distribution.json",
"type": "create"
},
{
"identifier": "${larvalDippingActionId}",
"prefix": 6,
"title": "กิจกรรมการตักลูกน้ำ",
"description": "ดำเนินกิจกรรมจับลูกน้ำอย่างน้อย 3 แห่งในพื้นที่ปฏิบัติงาน",
"code": "Larval Dipping",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "Larval_Dipping",
"subjectCodableConcept": {
"text": "Location"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Register_Structure event is submitted",
"expression": "questionnaire = 'Register_Structure'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Structure is a larval breeding site",
"expression": "$this.is(FHIR.QuestionnaireResponse) or $this.type.where(id='locationType').text = 'Larval Breeding Site'"
}
},
{
"kind": "applicability",
"expression": {
"description": "Apply to larval breeding sites in Register_Structure questionnaires",
"expression": "$this.is(FHIR.Location) or (questionnaire = 'Register_Structure' and $this.item.where(linkId='structureType').answer.value ='Larval Breeding Site')"
}
}
],
"definitionUri": "larval_dipping_form.json",
"type": "create"
},
{
"identifier": "${mosquitoCollectionActionId}",
"prefix": 7,
"title": "กิจกรรมการจับยุง",
"description": "กิจกรรมจับยุงกำหนดไว้อย่างน้อย 3 แห่ง",
"code": "Mosquito Collection",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "Mosquito_Collection",
"subjectCodableConcept": {
"text": "Location"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Register_Structure event is submitted",
"expression": "questionnaire = 'Register_Structure'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Structure is a mosquito collection point",
"expression": "$this.is(FHIR.QuestionnaireResponse) or $this.type.where(id='locationType').text = 'Mosquito Collection Point'"
}
},
{
"kind": "applicability",
"expression": {
"description": "Apply to mosquito collection point in Register_Structure questionnaires",
"expression": "$this.is(FHIR.Location) or (questionnaire = 'Register_Structure' and $this.item.where(linkId='structureType').answer.value ='Mosquito Collection Point')"
}
}
],
"definitionUri": "mosquito_collection_form.json",
"type": "create"
}
]
}
Template 2
{
"identifier": "${planIdentifier}",
"version": "1",
"name": "${focus_status}-${focus_name}-${patient_name}_${patient_surname}-${currentDate}-${flag}",
"title": "${focus_status} - ${focus_name} - ${patient_name} ${patient_surname} - ${currentDate} - ${flag}",
"status": "draft",
"date": "${currentDate}",
"effectivePeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"useContext": [
{
"code": "interventionType",
"valueCodableConcept": "Dynamic-FI"
},
{
"code": "fiStatus",
"valueCodableConcept": "${focus_status}"
},
{
"code": "fiReason",
"valueCodableConcept": "Case Triggered"
},
{
"code": "opensrpEventId",
"valueCodableConcept": "${opensrpCaseClassificationEventId}"
},
{
"code": "caseNum",
"valueCodableConcept": "${case_number}"
},
{
"code": "taskGenerationStatus",
"valueCodableConcept": "internal"
}
],
"jurisdiction": [
{
"code": "${focus_id}"
}
],
"serverVersion": 0,
"goal": [
{
"id": "Case_Confirmation",
"description": "ยืนยันบ้านผู้ป่วย",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนผู้ป่วยที่ได้รับการยืนยัน",
"detail": {
"detailQuantity": {
"value": 1,
"comparator": ">=",
"unit": "case(s)"
}
},
"due": "${endDate}"
}
]
},
{
"id": "RACD_register_families",
"description": "ลงทะเบียนครัวเรือนและสมาชิกในครัวเรือน (100%) ภายในพื้นที่ปฏิบัติงาน",
"priority": "medium-priority",
"target": [
{
"measure": "ร้อยละของบ้าน สิ่งปลูกสร้างที่ได้ลงทะเบียนข้อมูลครัวเรือน",
"detail": {
"detailQuantity": {
"value": 100.0,
"comparator": ">=",
"unit": "%"
}
},
"due": "${endDate}"
}
]
},
{
"id": "RACD_Blood_Screening",
"description": "เจาะเลือดรอบบ้านผู้ป่วยในรัศมี 1 กิโลเมตร (100%)",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนผู้ที่ได้รับการเจาะโลหิต",
"detail": {
"detailQuantity": {
"value": 50.0,
"comparator": ">=",
"unit": "คน"
}
},
"due": "${endDate}"
}
]
},
{
"id": "BCC_Focus",
"description": "ให้สุขศึกษาในพื้นที่ปฏิบัติงานอย่างน้อย 1 ครั้ง",
"priority": "medium-priority",
"target": [
{
"measure": "จำนวนกิจกรรมการให้สุขศึกษา",
"detail": {
"detailQuantity": {
"value": 1.0,
"comparator": ">=",
"unit": "แห่ง"
}
},
"due": "${endDate}"
}
]
}
],
"action": [
{
"identifier": "662d4bff-43cc-4f50-af1e-3bc86f8af253",
"prefix": 1,
"title": "การยืนยันบ้านผู้ป่วย",
"description": "ยืนยันบ้านผู้ป่วย",
"code": "Case Confirmation",
"timingPeriod": {
"start": "2021-09-13",
"end": "2021-09-23"
},
"reason": "Investigation",
"goalId": "Case_Confirmation",
"subjectCodableConcept": {
"text": "Jurisdiction"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Event is case details event",
"expression": "questionnaire = 'Case_Details'"
}
}
],
"definitionUri": "case_confirmation.json",
"type": "create"
},
{
"identifier": "${registerFamilyActionId}",
"prefix": 2,
"title": "ลงทะเบียนครัวเรือน",
"description": "ลงทะเบียนครัวเรือนและสมาชิกในครัวเรือน (100%) ภายในพื้นที่ปฏิบัติงาน",
"code": "RACD Register Family",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "RACD_register_families",
"subjectCodableConcept": {
"text": "Location"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Register_Structure event is submitted",
"expression": "questionnaire = 'Register_Structure' or questionnaire = 'Archive_Family'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Structure is residential or type does not exist",
"expression": "$this.is(FHIR.QuestionnaireResponse) or (($this.type.where(id='locationType').exists().not() or $this.type.where(id='locationType').text = 'Residential Structure') and $this.contained.exists().not())",
"subjectCodableConcept": {
"text": "Family"
}
}
},
{
"kind": "applicability",
"expression": {
"description": "Apply to residential structures in Register_Structure questionnaires",
"expression": "$this.is(FHIR.Location) or (questionnaire = 'Register_Structure' and $this.item.where(linkId='structureType').answer.value ='Residential Structure')"
}
}
],
"definitionUri": "family_register.json",
"type": "create"
},
{
"identifier": "${bloodScreeningActionId}",
"prefix": 3,
"title": "กิจกรรมการเจาะโลหิต",
"description": "เจาะเลือดรอบบ้านผู้ป่วยในรัศมี 1 กิโลเมตร (100%)",
"code": "Blood Screening",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "RACD_Blood_Screening",
"subjectCodableConcept": {
"text": "Person"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
},
{
"type": "named-event",
"name": "event-submission",
"expression": {
"description": "Trigger when a Family Registration or Family Member Registration event is submitted",
"expression": "questionnaire = 'Family_Registration' or questionnaire = 'Family_Member_Registration'"
}
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Person is older than 5 years or person associated with questionnaire response if older than 5 years",
"expression": "($this.is(FHIR.Patient) and $this.birthDate <= today() - 5 'years') or ($this.contained.where(Patient.birthDate <= today() - 5 'years').exists())"
}
}
],
"definitionUri": "blood_screening.json",
"type": "create"
},
{
"identifier": "${bccActionId}",
"prefix": 4,
"title": "กิจกรรมการให้สุขศึกษา",
"description": "ดำเนินกิจกรรมให้สุขศึกษา",
"code": "BCC",
"timingPeriod": {
"start": "${currentDate}",
"end": "${endDate}"
},
"reason": "Investigation",
"goalId": "BCC_Focus",
"subjectCodableConcept": {
"text": "Jurisdiction"
},
"trigger": [
{
"type": "named-event",
"name": "plan-activation"
}
],
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Jurisdiction type location",
"expression": "Location.physicalType.coding.exists(code='jdn')"
}
}
],
"definitionUri": "behaviour_change_communication.json",
"type": "create"
}
]
}
How to post a plan template
Make a POST request to /rest/templates
The request body should contain the following
{ "templateId": 1, "template": {{template_body}}, "version": 0, "type": "plan" }
The template id
refers the template version used. The examples given above are 1 and 2 . The type
is plan
for both templates
The template
field contains the actual plan template. For simplicity and ease in viewing the template we use the pre-request-scripts
functionlaity in postman to store the plan template in a template_body
variable that is reference above.
var body =
// template goes here
;
pm.environment.set('template_body', JSON.stringify(body));
@Rkareko cc @samkanga
Tested adding a plan template and this was tested on the Thai - preview and template 1 above.
Noted that when you try to retrieve the same template via GET to this endpoint https://reveal-th-preview.smartregister.org/opensrp/rest/templates/1
The template is incomplete and missing some parts.
see below template retrieved compared to the one posted here
Retrieved template:
{ "templateId": 1, "template": { "identifier": "${planIdentifier}", "version": "1", "name": "${focus_status}-${focus_name}-${patient_name}_${patient_surname}-${currentDate}-${flag}", "title": "${focus_status} - ${focus_name} - ${patient_name} ${patient_surname} - ${currentDate} - ${flag}", "status": "draft", "date": "${currentDate}", "effectivePeriod": { "start": "${currentDate}", "end": "${endDate}" }, "useContext": [ { "code": "interventionType", "valueCodableConcept": "Dynamic-FI" }, { "code": "fiStatus", "valueCodableConcept": "${focus_status}" }, { "code": "fiReason", "valueCodableConcept": "Case Triggered" }, { "code": "opensrpEventId", "valueCodableConcept": "${opensrpCaseClassificationEventId}" }, { "code": "caseNum", "valueCodableConcept": "${case_number}" }, { "code": "taskGenerationStatus", "valueCodableConcept": "internal" } ], "jurisdiction": [ { "code": "${focus_id}" } ], "serverVersion": 0, "experimental": false }, "version": 0
Template 1 and template 2 can be successfully added and retrieved. This has been tested by Posting the two templates and then doing a get request and comparing the response payload with that of the initial post.
However there has been an issue noted on task generation where RabbitMQ was missing on thai preview.This has since been installed.
Presently, on Thailand production environment, case triggered plans (RACD) are generated from NiFi.
In the recent past, there has been issues with plan generation. This was pointed to unavailability of nay of the 3 systems that are involved in RACD plan generation, that include OpenSRP and postgreSQL DB. As a mitigation, a recommendation was made to shift the plan generation from NiFi to OpenSRP to reduce the number of components involved in plan generation. This move is anticipated to reduce the incidents where RAC plan generation failed.
This work is anticipated to take about 3.5 weeks to complete. The technical scoping can be accessed here.
Tasks
QA
/rest/templates/{templateId}
c) Verify that the templates are correctp_site_id
and asource_site_id
. This can be checked by confirming that data inserted to mhealth DB contains p_site_id and a source_site_id.