Skip to content

Commit

Permalink
POC-39:Separate CCC Number From Other Identifiers (AMPATH#1223)
Browse files Browse the repository at this point in the history
Co-authored-by: Kipchumba C. Bett <kbett68@gmail.com>
  • Loading branch information
Alfred-Mutai and corneliouzbett authored Mar 20, 2023
1 parent 1049c21 commit ae5949e
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@
"joinCondition": "t2.visit_id = t20.visit_id"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "t2.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "t2.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "t2.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
},
{
"table": "etl.program_visit_map",
"alias": "t21",
Expand Down Expand Up @@ -93,6 +117,21 @@
"alias": "d",
"column": "date_format(t2.scheduled_date,'%Y-%m-%d')"
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "simple_column",
"alias": "med_pick_up_date",
Expand Down
39 changes: 39 additions & 0 deletions app/reporting-framework/json-reports/hiv-summary-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@
"type": "INNER",
"joinCondition": "fhs.person_id = p.person_id"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "fhs.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "fhs.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "fhs.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
}
],
"columns": [
Expand Down Expand Up @@ -56,6 +80,21 @@
"expression": "if(fhs.cur_arv_line=2,1,null)"
}
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "derived_column",
"alias": "on_tdf_3tc_efv_400",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@
"type": "INNER",
"joinCondition": "l.location_id = hmsd.location_id"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
}
],
"columns": [
Expand All @@ -34,6 +58,21 @@
"alias": "age",
"column": "hmsd.age"
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "simple_column",
"alias": "person_id",
Expand Down
39 changes: 39 additions & 0 deletions app/reporting-framework/json-reports/main-dataset-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@
"type": "LEFT",
"joinCondition": "csm.person_id = hmsd.person_id AND csm.endDate = hmsd.endDate"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "hmsd.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
}
],
"columns": [
Expand All @@ -37,6 +61,21 @@
"alias": "birthdate",
"column": "hmsd.birthdate"
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "simple_column",
"alias": "age",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@
"joinCondition": "t1.person_id = pa.person_id"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovc_id",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ovc_id.patient_id AND (ovc_id.voided IS NULL || ovc_id.voided = 0) AND ovc_id.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovc_id",
Expand Down Expand Up @@ -84,6 +108,16 @@
"alias": "person_id",
"column": "t1.person_id"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "derived_column",
"alias": "person_name",
Expand All @@ -105,6 +139,11 @@
"alias": "ovc_identifier",
"column": "ovc_id.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovc_id.identifier"
},
{
"type": "derived_column",
"alias": "phone_number",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@
"joinCondition": "t1.person_id = id.patient_id AND (id.voided IS NULL || id.voided = 0)"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
},
{
"table": "amrs.person_attribute",
"alias": "contacts",
Expand Down Expand Up @@ -95,6 +119,21 @@
"expression": "t1.uuid"
}
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "simple_column",
"alias": "person_id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,34 @@
},
{
"table": "amrs.patient_identifier",
"alias": "id",
"alias": "ccc",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = id.patient_id AND (id.voided IS NULL || id.voided = 0)"
"joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ovcid",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43"
}
},
{
"table": "amrs.patient_identifier",
"alias": "upi",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45"
}
},
{
"table": "amrs.patient_identifier",
"alias": "ids",
"join": {
"type": "LEFT",
"joinCondition": "t1.person_id = ids.patient_id AND (ids.voided IS NULL || ids.voided = 0)"
}
},
{
Expand Down Expand Up @@ -142,14 +166,29 @@
"expression": " CONCAT(COALESCE(person_name.given_name, ''), ' ', COALESCE(person_name.middle_name, ''), ' ', COALESCE(person_name.family_name, ''))"
}
},
{
"type": "simple_column",
"alias": "ccc_number",
"column": "ccc.identifier"
},
{
"type": "simple_column",
"alias": "ovcid_id",
"column": "ovcid.identifier"
},
{
"type": "derived_column",
"alias": "identifiers",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": " GROUP_CONCAT(DISTINCT id.identifier SEPARATOR ', ')"
"expression": "GROUP_CONCAT(DISTINCT ids.identifier SEPARATOR ', ')"
}
},
{
"type": "simple_column",
"alias": "upi_number",
"column": "upi.identifier"
},
{
"type": "derived_column",
"alias": "phone_number",
Expand Down
Loading

0 comments on commit ae5949e

Please sign in to comment.